File tree Expand file tree Collapse file tree 2 files changed +2
-7
lines changed Expand file tree Collapse file tree 2 files changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -92,19 +92,17 @@ public function contents()
9292 throw new ArchiveIOException ('Can not read from a closed archive ' );
9393 }
9494
95- $ result = array ();
9695 while ($ read = $ this ->readbytes (512 )) {
9796 $ header = $ this ->parseHeader ($ read );
9897 if (!is_array ($ header )) {
9998 continue ;
10099 }
101100
102101 $ this ->skipbytes (ceil ($ header ['size ' ] / 512 ) * 512 );
103- $ result [] = $ this ->header2fileinfo ($ header );
102+ yield $ this ->header2fileinfo ($ header );
104103 }
105104
106105 $ this ->close ();
107- return $ result ;
108106 }
109107
110108 /**
Original file line number Diff line number Diff line change @@ -77,19 +77,16 @@ public function contents()
7777 throw new ArchiveIOException ('Can not read from a closed archive ' );
7878 }
7979
80- $ result = array ();
81-
8280 $ centd = $ this ->readCentralDir ();
8381
8482 @rewind ($ this ->fh );
8583 @fseek ($ this ->fh , $ centd ['offset ' ]);
8684
8785 for ($ i = 0 ; $ i < $ centd ['entries ' ]; $ i ++) {
88- $ result [] = $ this ->header2fileinfo ($ this ->readCentralFileHeader ());
86+ yield $ this ->header2fileinfo ($ this ->readCentralFileHeader ());
8987 }
9088
9189 $ this ->close ();
92- return $ result ;
9390 }
9491
9592 /**
You can’t perform that action at this time.
0 commit comments