@@ -121,8 +121,7 @@ |
||
121 | 121 | $entry->getUncompressedSize() < 20 || |
122 | 122 | $entry->getCompressionMethod() === ZipCompressionMethod::BZIP2 |
123 | 123 | ) ? |
124 | - self::VERSION_AE2 : |
|
125 | - self::VERSION_AE1; |
|
124 | + self::VERSION_AE2 : self::VERSION_AE1; |
|
126 | 125 | |
127 | 126 | $field = new self($vendorVersion, $keyStrength, $entry->getCompressionMethod()); |
128 | 127 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $entries = (array) $entries; |
35 | 35 | $entries = array_map( |
36 | - static function ($entry) { |
|
36 | + static function($entry) { |
|
37 | 37 | return $entry instanceof ZipEntry ? $entry->getName() : (string) $entry; |
38 | 38 | }, |
39 | 39 | $entries |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param ZipEntry $entry |
74 | 74 | * @param string $entryName |
75 | 75 | */ |
76 | - function (ZipEntry $entry, $entryName) use ($regexp) { |
|
76 | + function(ZipEntry $entry, $entryName) use ($regexp) { |
|
77 | 77 | if (preg_match($regexp, $entryName)) { |
78 | 78 | $this->matches[] = (string) $entryName; |
79 | 79 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | array_walk( |
109 | 109 | $this->matches, |
110 | 110 | /** @param string $entryName */ |
111 | - static function ($entryName) use ($callable) { |
|
111 | + static function($entryName) use ($callable) { |
|
112 | 112 | $callable($entryName); |
113 | 113 | } |
114 | 114 | ); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | array_walk( |
129 | 129 | $this->matches, |
130 | 130 | /** @param string $entryName */ |
131 | - function ($entryName) { |
|
131 | + function($entryName) { |
|
132 | 132 | $this->zipContainer->deleteEntry($entryName); |
133 | 133 | } |
134 | 134 | ); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | array_walk( |
145 | 145 | $this->matches, |
146 | 146 | /** @param string $entryName */ |
147 | - function ($entryName) use ($password, $encryptionMethod) { |
|
147 | + function($entryName) use ($password, $encryptionMethod) { |
|
148 | 148 | $entry = $this->zipContainer->getEntry($entryName); |
149 | 149 | |
150 | 150 | if (!$entry->isDirectory()) { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | array_walk( |
163 | 163 | $this->matches, |
164 | 164 | /** @param string $entryName */ |
165 | - function ($entryName) use ($encryptionMethod) { |
|
165 | + function($entryName) use ($encryptionMethod) { |
|
166 | 166 | $entry = $this->zipContainer->getEntry($entryName); |
167 | 167 | |
168 | 168 | if (!$entry->isDirectory()) { |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | array_walk( |
178 | 178 | $this->matches, |
179 | 179 | /** @param string $entryName */ |
180 | - function ($entryName) { |
|
180 | + function($entryName) { |
|
181 | 181 | $entry = $this->zipContainer->getEntry($entryName); |
182 | 182 | |
183 | 183 | if (!$entry->isDirectory()) { |
@@ -268,8 +268,7 @@ |
||
268 | 268 | $this->extractVersion = max( |
269 | 269 | $this->extractVersion, |
270 | 270 | $this->isDirectory ? |
271 | - ZipVersion::v20_DEFLATED_FOLDER_ZIPCRYPTO : |
|
272 | - ZipVersion::v10_DEFAULT_MIN |
|
271 | + ZipVersion::v20_DEFLATED_FOLDER_ZIPCRYPTO : ZipVersion::v10_DEFAULT_MIN |
|
273 | 272 | ); |
274 | 273 | } |
275 | 274 |
@@ -559,8 +559,7 @@ discard block |
||
559 | 559 | } else { |
560 | 560 | $mimeType = FilesUtil::getMimeTypeFromString($contents); |
561 | 561 | $compressionMethod = FilesUtil::isBadCompressionMimeType($mimeType) ? |
562 | - ZipCompressionMethod::STORED : |
|
563 | - ZipCompressionMethod::DEFLATED; |
|
562 | + ZipCompressionMethod::STORED : ZipCompressionMethod::DEFLATED; |
|
564 | 563 | } |
565 | 564 | } |
566 | 565 | |
@@ -661,8 +660,7 @@ discard block |
||
661 | 660 | $compressionMethod = ZipCompressionMethod::STORED; |
662 | 661 | } else { |
663 | 662 | $compressionMethod = FilesUtil::isBadCompressionFile($file->getPathname()) ? |
664 | - ZipCompressionMethod::STORED : |
|
665 | - ZipCompressionMethod::DEFLATED; |
|
663 | + ZipCompressionMethod::STORED : ZipCompressionMethod::DEFLATED; |
|
666 | 664 | } |
667 | 665 | |
668 | 666 | $zipEntry->setUncompressedSize($file->getSize()); |
@@ -806,8 +804,7 @@ discard block |
||
806 | 804 | rewind($stream); |
807 | 805 | $mimeType = FilesUtil::getMimeTypeFromString($bufferContents); |
808 | 806 | $compressionMethod = FilesUtil::isBadCompressionMimeType($mimeType) ? |
809 | - ZipCompressionMethod::STORED : |
|
810 | - ZipCompressionMethod::DEFLATED; |
|
807 | + ZipCompressionMethod::STORED : ZipCompressionMethod::DEFLATED; |
|
811 | 808 | } |
812 | 809 | $zipEntry->setUncompressedSize($length); |
813 | 810 | } |
@@ -974,8 +971,7 @@ discard block |
||
974 | 971 | } |
975 | 972 | |
976 | 973 | $iterator = $iterator instanceof \RecursiveIterator ? |
977 | - new \RecursiveIteratorIterator($iterator) : |
|
978 | - new \IteratorIterator($iterator); |
|
974 | + new \RecursiveIteratorIterator($iterator) : new \IteratorIterator($iterator); |
|
979 | 975 | /** |
980 | 976 | * @var string[] $files |
981 | 977 | * @var string $path |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | public function openFile($filename, array $options = []) |
104 | 104 | { |
105 | 105 | if (!file_exists($filename)) { |
106 | - throw new ZipException("File {$filename} does not exist."); |
|
106 | + throw new ZipException("file {$filename} does not exist."); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | if (!($handle = @fopen($filename, 'rb'))) { |
110 | - throw new ZipException("File {$filename} can't open."); |
|
110 | + throw new ZipException("file {$filename} can't open."); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $this->openFromStream($handle, $options); |
@@ -1793,7 +1793,7 @@ discard block |
||
1793 | 1793 | $this->close(); |
1794 | 1794 | |
1795 | 1795 | if (!($handle = @fopen($meta['uri'], 'rb'))) { |
1796 | - throw new ZipException("File {$meta['uri']} can't open."); |
|
1796 | + throw new ZipException("file {$meta['uri']} can't open."); |
|
1797 | 1797 | } |
1798 | 1798 | } else { |
1799 | 1799 | $handle = @fopen('php://temp', 'r+b'); |
@@ -275,7 +275,7 @@ |
||
275 | 275 | '/', |
276 | 276 | array_filter( |
277 | 277 | explode('/', (string) $path), |
278 | - static function ($part) { |
|
278 | + static function($part) { |
|
279 | 279 | return $part !== '.' && $part !== '..'; |
280 | 280 | } |
281 | 281 | ) |
@@ -81,7 +81,7 @@ |
||
81 | 81 | if ($permission & self::UNX_IXUSR) { |
82 | 82 | $mode .= ($permission & self::UNX_ISUID) ? 's' : 'x'; |
83 | 83 | } else { |
84 | - $mode .= ($permission & self::UNX_ISUID) ? 'S' : '-'; // S==undefined |
|
84 | + $mode .= ($permission & self::UNX_ISUID) ? 'S' : '-'; // S==undefined |
|
85 | 85 | } |
86 | 86 | $mode .= ($permission & self::UNX_IRGRP) ? 'r' : '-'; |
87 | 87 | $mode .= ($permission & self::UNX_IWGRP) ? 'w' : '-'; |
@@ -55,11 +55,11 @@ |
||
55 | 55 | } |
56 | 56 | // date_default_timezone_set('UTC'); |
57 | 57 | return mktime( |
58 | - (($dosTime >> 11) & 0x1f), // hours |
|
59 | - (($dosTime >> 5) & 0x3f), // minutes |
|
60 | - (($dosTime << 1) & 0x3e), // seconds |
|
61 | - (($dosTime >> 21) & 0x0f), // month |
|
62 | - (($dosTime >> 16) & 0x1f), // day |
|
58 | + (($dosTime >> 11) & 0x1f), // hours |
|
59 | + (($dosTime >> 5) & 0x3f), // minutes |
|
60 | + (($dosTime << 1) & 0x3e), // seconds |
|
61 | + (($dosTime >> 21) & 0x0f), // month |
|
62 | + (($dosTime >> 16) & 0x1f), // day |
|
63 | 63 | ((($dosTime >> 25) & 0x7f) + 1980) // year |
64 | 64 | ); |
65 | 65 | } |
@@ -67,8 +67,7 @@ |
||
67 | 67 | $this->context = new PKCryptContext($password); |
68 | 68 | |
69 | 69 | $crc = $entry->isDataDescriptorRequired() || $entry->getCrc() === ZipEntry::UNKNOWN ? |
70 | - ($entry->getDosTime() & 0x0000ffff) << 16 : |
|
71 | - $entry->getCrc(); |
|
70 | + ($entry->getDosTime() & 0x0000ffff) << 16 : $entry->getCrc(); |
|
72 | 71 | |
73 | 72 | try { |
74 | 73 | $headerBytes = random_bytes(PKCryptContext::STD_DEC_HDR_SIZE); |
@@ -267,8 +267,7 @@ discard block |
||
267 | 267 | { |
268 | 268 | $local = (bool) $local; |
269 | 269 | $collection = $local ? |
270 | - $entry->getLocalExtraFields() : |
|
271 | - $entry->getCdExtraFields(); |
|
270 | + $entry->getLocalExtraFields() : $entry->getCdExtraFields(); |
|
272 | 271 | $extraData = ''; |
273 | 272 | |
274 | 273 | foreach ($collection as $extraField) { |
@@ -767,7 +766,7 @@ discard block |
||
767 | 766 | // find max software version, version needed to extract and most common platform |
768 | 767 | list($softwareVersion, $versionNeededToExtract) = array_reduce( |
769 | 768 | $this->zipContainer->getEntries(), |
770 | - static function (array $carry, ZipEntry $entry) { |
|
769 | + static function(array $carry, ZipEntry $entry) { |
|
771 | 770 | $carry[0] = max($carry[0], $entry->getSoftwareVersion() & 0xFF); |
772 | 771 | $carry[1] = max($carry[1], $entry->getExtractVersion() & 0xFF); |
773 | 772 |