11<?php namespace io \archive \zip ;
22
3+ use io \streams \{InputStream , Seekable };
4+
35/**
46 * Read from a zip file
57 *
68 * Usage in foreach
79 * ----------------
8- * <code>
9- * $z= ZipFile::open(new FileInputStream(new File('dist.zip')));
10- * foreach ($reader->entries() as $entry) {
11- * // ...
12- * }
13- * </code>
10+ * ```php
11+ * $z= ZipFile::open(new FileInputStream(new File('dist.zip')));
12+ * foreach ($reader->entries() as $entry) {
13+ * // ...
14+ * }
15+ * ```
1416 *
1517 * Usage with iterator
1618 * -------------------
17- * <code>
18- * $z= ZipFile::open(new FileInputStream(new File('dist.zip')));
19- * $it= $z->iterator();
20- * while ($it->hasNext()) {
21- * $entry= $it->next();
22- * // ...
23- * }
24- * </code>
19+ * ```php
20+ * $z= ZipFile::open(new FileInputStream(new File('dist.zip')));
21+ * $it= $z->iterator();
22+ * while ($it->hasNext()) {
23+ * $entry= $it->next();
24+ * // ...
25+ * }
26+ * ```
2527 *
26- * @test xp://net.xp_framework.unittest. io.archive.ZipArchiveReaderTest
27- * @test xp://net.xp_framework.unittest. io.archive.ZipFileEntriesTest
28- * @test xp://net.xp_framework.unittest. io.archive.ZipFileIteratorTest
29- * @see xp:// io.archive.zip.ZipArchive#open
28+ * @test io.archive.zip.unittest .ZipArchiveReaderTest
29+ * @test io.archive.zip.unittest .ZipFileEntriesTest
30+ * @test io.archive.zip.unittest .ZipFileIteratorTest
31+ * @see io.archive.zip.ZipArchive#open
3032 */
3133class ZipArchiveReader {
3234 protected $ impl = NULL ;
3335
3436 /**
3537 * Creation constructor
3638 *
37- * @param io.streams.InputStream stream
39+ * @param io.streams.InputStream $ stream
3840 */
39- public function __construct (\ io \ streams \ InputStream $ stream ) {
40- if ($ stream instanceof \ io \ streams \ Seekable) {
41+ public function __construct (InputStream $ stream ) {
42+ if ($ stream instanceof Seekable) {
4143 $ this ->impl = new RandomAccessZipReaderImpl ($ stream );
4244 } else {
4345 $ this ->impl = new SequentialZipReaderImpl ($ stream );
@@ -47,8 +49,8 @@ public function __construct(\io\streams\InputStream $stream) {
4749 /**
4850 * Set password to use when extracting
4951 *
50- * @param string password
51- * @return io.archive.zip.ZipArchiveReader this
52+ * @param string $ password
53+ * @return self
5254 */
5355 public function usingPassword ($ password ) {
5456 $ this ->impl ->setPassword ($ password );
@@ -58,7 +60,7 @@ public function usingPassword($password) {
5860 /**
5961 * Returns a list of all entries in this zip file
6062 *
61- * @return io.archive.zip.ZipEntries
63+ * @return io.archive.zip.ZipEntries
6264 */
6365 public function entries () {
6466 return new ZipEntries ($ this ->impl );
@@ -67,14 +69,16 @@ public function entries() {
6769 /**
6870 * Returns an iterator of all entries in this zip file
6971 *
70- * @return io.archive.zip.ZipIterator
72+ * @return io.archive.zip.ZipIterator
7173 */
7274 public function iterator () {
7375 return new ZipIterator ($ this ->impl );
7476 }
7577
7678 /**
7779 * Closes underlying stream
80+ *
81+ * @return void
7882 */
7983 public function close () {
8084 $ this ->impl ->close ();
0 commit comments