@@ -100,7 +100,7 @@ |
||
100 | 100 | */ |
101 | 101 | public function isSeekable(): bool |
102 | 102 | { |
103 | - return (bool)$this->getMetadata('seekable'); |
|
103 | + return (bool) $this->getMetadata('seekable'); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -100,9 +100,9 @@ |
||
100 | 100 | public function getLowFF(bool $force = false): float |
101 | 101 | { |
102 | 102 | if ($force || $this->isOver32()) { |
103 | - return (float)0xFFFFFFFF; |
|
103 | + return (float) 0xFFFFFFFF; |
|
104 | 104 | } |
105 | - return (float)$this->getLow32(); |
|
105 | + return (float) $this->getLow32(); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -390,16 +390,16 @@ discard block |
||
390 | 390 | $cdr_offset = $this->ofs; |
391 | 391 | |
392 | 392 | $fields = [ |
393 | - ['V', static::ZIP64_CDR_EOF_SIGNATURE], // ZIP64 end of central file header signature |
|
394 | - ['P', 44], // Length of data below this header (length of block - 12) = 44 |
|
395 | - ['v', static::ZIP_VERSION_MADE_BY], // Made by version |
|
396 | - ['v', Version::ZIP64], // Extract by version |
|
397 | - ['V', 0x00], // disk number |
|
398 | - ['V', 0x00], // no of disks |
|
399 | - ['P', $num_files], // no of entries on disk |
|
400 | - ['P', $num_files], // no of entries in cdr |
|
401 | - ['P', $cdr_length], // CDR size |
|
402 | - ['P', $cdr_offset], // CDR offset |
|
393 | + ['V', static::ZIP64_CDR_EOF_SIGNATURE], // ZIP64 end of central file header signature |
|
394 | + ['P', 44], // Length of data below this header (length of block - 12) = 44 |
|
395 | + ['v', static::ZIP_VERSION_MADE_BY], // Made by version |
|
396 | + ['v', Version::ZIP64], // Extract by version |
|
397 | + ['V', 0x00], // disk number |
|
398 | + ['V', 0x00], // no of disks |
|
399 | + ['P', $num_files], // no of entries on disk |
|
400 | + ['P', $num_files], // no of entries in cdr |
|
401 | + ['P', $cdr_length], // CDR size |
|
402 | + ['P', $cdr_offset], // CDR offset |
|
403 | 403 | ]; |
404 | 404 | |
405 | 405 | $ret = static::packFields($fields); |
@@ -517,9 +517,9 @@ discard block |
||
517 | 517 | |
518 | 518 | $fields = [ |
519 | 519 | ['V', static::ZIP64_CDR_LOCATOR_SIGNATURE], // ZIP64 end of central file header signature |
520 | - ['V', 0x00], // Disc number containing CDR64EOF |
|
521 | - ['P', $cdr_offset], // CDR offset |
|
522 | - ['V', 1], // Total number of disks |
|
520 | + ['V', 0x00], // Disc number containing CDR64EOF |
|
521 | + ['P', $cdr_offset], // CDR offset |
|
522 | + ['V', 1], // Total number of disks |
|
523 | 523 | ]; |
524 | 524 | |
525 | 525 | $ret = static::packFields($fields); |
@@ -541,17 +541,17 @@ discard block |
||
541 | 541 | $comment = $this->opt->getComment(); |
542 | 542 | |
543 | 543 | $fields = [ |
544 | - ['V', static::CDR_EOF_SIGNATURE], // end of central file header signature |
|
545 | - ['v', 0x00], // disk number |
|
546 | - ['v', 0x00], // no of disks |
|
547 | - ['v', min($num_files, 0xFFFF)], // no of entries on disk |
|
548 | - ['v', min($num_files, 0xFFFF)], // no of entries in cdr |
|
549 | - ['V', $cdr_length->getLowFF()], // CDR size |
|
550 | - ['V', $cdr_offset->getLowFF()], // CDR offset |
|
551 | - ['v', \strlen($comment)], // Zip Comment size |
|
544 | + ['V', static::CDR_EOF_SIGNATURE], // end of central file header signature |
|
545 | + ['v', 0x00], // disk number |
|
546 | + ['v', 0x00], // no of disks |
|
547 | + ['v', min($num_files, 0xFFFF)], // no of entries on disk |
|
548 | + ['v', min($num_files, 0xFFFF)], // no of entries in cdr |
|
549 | + ['V', $cdr_length->getLowFF()], // CDR size |
|
550 | + ['V', $cdr_offset->getLowFF()], // CDR offset |
|
551 | + ['v', \strlen($comment)], // Zip Comment size |
|
552 | 552 | ]; |
553 | 553 | |
554 | - $ret = static::packFields($fields) . $comment; |
|
554 | + $ret = static::packFields($fields).$comment; |
|
555 | 555 | $this->send($ret); |
556 | 556 | } |
557 | 557 |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | if (!mb_check_encoding($name, 'UTF-8') || |
164 | 164 | !mb_check_encoding($comment, 'UTF-8')) { |
165 | 165 | throw new EncodingException( |
166 | - 'File name and comment should use UTF-8 ' . |
|
166 | + 'File name and comment should use UTF-8 '. |
|
167 | 167 | 'if one of them does not fit into ASCII range.' |
168 | 168 | ); |
169 | 169 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $this->version = Version::DEFLATE(); |
175 | 175 | } |
176 | 176 | |
177 | - $force = (boolean)($this->bits & self::BIT_ZERO_HEADER) && |
|
177 | + $force = (boolean) ($this->bits & self::BIT_ZERO_HEADER) && |
|
178 | 178 | $this->zip->opt->isEnableZip64(); |
179 | 179 | |
180 | 180 | $footer = $this->buildZip64ExtraBlock($force); |
@@ -188,22 +188,22 @@ discard block |
||
188 | 188 | |
189 | 189 | $fields = [ |
190 | 190 | ['V', ZipStream::FILE_HEADER_SIGNATURE], |
191 | - ['v', $this->version->getValue()], // Version needed to Extract |
|
192 | - ['v', $this->bits], // General purpose bit flags - data descriptor flag set |
|
193 | - ['v', $this->method->getValue()], // Compression method |
|
194 | - ['V', $time], // Timestamp (DOS Format) |
|
195 | - ['V', $this->crc], // CRC32 of data (0 -> moved to data descriptor footer) |
|
196 | - ['V', $this->zlen->getLowFF($force)], // Length of compressed data (forced to 0xFFFFFFFF for zero header) |
|
197 | - ['V', $this->len->getLowFF($force)], // Length of original data (forced to 0xFFFFFFFF for zero header) |
|
198 | - ['v', $nameLength], // Length of filename |
|
199 | - ['v', \strlen($footer)], // Extra data (see above) |
|
191 | + ['v', $this->version->getValue()], // Version needed to Extract |
|
192 | + ['v', $this->bits], // General purpose bit flags - data descriptor flag set |
|
193 | + ['v', $this->method->getValue()], // Compression method |
|
194 | + ['V', $time], // Timestamp (DOS Format) |
|
195 | + ['V', $this->crc], // CRC32 of data (0 -> moved to data descriptor footer) |
|
196 | + ['V', $this->zlen->getLowFF($force)], // Length of compressed data (forced to 0xFFFFFFFF for zero header) |
|
197 | + ['V', $this->len->getLowFF($force)], // Length of original data (forced to 0xFFFFFFFF for zero header) |
|
198 | + ['v', $nameLength], // Length of filename |
|
199 | + ['v', \strlen($footer)], // Extra data (see above) |
|
200 | 200 | ]; |
201 | 201 | |
202 | 202 | // pack fields and calculate "total" length |
203 | 203 | $header = ZipStream::packFields($fields); |
204 | 204 | |
205 | 205 | // print header and filename |
206 | - $data = $header . $name . $footer; |
|
206 | + $data = $header.$name.$footer; |
|
207 | 207 | $this->zip->send($data); |
208 | 208 | |
209 | 209 | // save header length |
@@ -267,15 +267,15 @@ discard block |
||
267 | 267 | |
268 | 268 | $fields = []; |
269 | 269 | if ($this->len->isOver32($force)) { |
270 | - $fields[] = ['P', $this->len]; // Length of original data |
|
270 | + $fields[] = ['P', $this->len]; // Length of original data |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | if ($this->len->isOver32($force)) { |
274 | - $fields[] = ['P', $this->zlen]; // Length of compressed data |
|
274 | + $fields[] = ['P', $this->zlen]; // Length of compressed data |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | if ($this->ofs->isOver32()) { |
278 | - $fields[] = ['P', $this->ofs]; // Offset of local header record |
|
278 | + $fields[] = ['P', $this->ofs]; // Offset of local header record |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | if (!empty($fields)) { |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | |
286 | 286 | \array_unshift( |
287 | 287 | $fields, |
288 | - ['v', 0x0001], // 64 bit extension |
|
288 | + ['v', 0x0001], // 64 bit extension |
|
289 | 289 | ['v', \count($fields) * 8] // Length of data block |
290 | 290 | ); |
291 | 291 | $this->version = Version::ZIP64(); |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | } |
312 | 312 | $fields = [ |
313 | 313 | ['V', ZipStream::DATA_DESCRIPTOR_SIGNATURE], |
314 | - ['V', $this->crc], // CRC32 |
|
315 | - [$sizeFormat, $this->zlen], // Length of compressed data |
|
316 | - [$sizeFormat, $this->len], // Length of original data |
|
314 | + ['V', $this->crc], // CRC32 |
|
315 | + [$sizeFormat, $this->zlen], // Length of compressed data |
|
316 | + [$sizeFormat, $this->len], // Length of original data |
|
317 | 317 | ]; |
318 | 318 | |
319 | 319 | $footer = ZipStream::packFields($fields); |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $data = $stream->read(self::CHUNKED_READ_BLOCK_SIZE); |
355 | 355 | $total += \strlen($data); |
356 | 356 | if ($size > 0 && $total > $size) { |
357 | - $data = \substr($data, 0 , \strlen($data)-($total - $size)); |
|
357 | + $data = \substr($data, 0, \strlen($data) - ($total - $size)); |
|
358 | 358 | } |
359 | 359 | $this->deflateData($stream, $data, $options); |
360 | 360 | if ($options & self::SEND) { |
@@ -443,28 +443,28 @@ discard block |
||
443 | 443 | $footer = $this->buildZip64ExtraBlock(); |
444 | 444 | |
445 | 445 | $fields = [ |
446 | - ['V', ZipStream::CDR_FILE_SIGNATURE], // Central file header signature |
|
447 | - ['v', ZipStream::ZIP_VERSION_MADE_BY], // Made by version |
|
448 | - ['v', $this->version->getValue()], // Extract by version |
|
449 | - ['v', $this->bits], // General purpose bit flags - data descriptor flag set |
|
450 | - ['v', $this->method->getValue()], // Compression method |
|
451 | - ['V', $time], // Timestamp (DOS Format) |
|
452 | - ['V', $this->crc], // CRC32 |
|
453 | - ['V', $this->zlen->getLowFF()], // Compressed Data Length |
|
454 | - ['V', $this->len->getLowFF()], // Original Data Length |
|
455 | - ['v', \strlen($name)], // Length of filename |
|
456 | - ['v', \strlen($footer)], // Extra data len (see above) |
|
457 | - ['v', \strlen($comment)], // Length of comment |
|
458 | - ['v', 0], // Disk number |
|
459 | - ['v', 0], // Internal File Attributes |
|
460 | - ['V', 32], // External File Attributes |
|
446 | + ['V', ZipStream::CDR_FILE_SIGNATURE], // Central file header signature |
|
447 | + ['v', ZipStream::ZIP_VERSION_MADE_BY], // Made by version |
|
448 | + ['v', $this->version->getValue()], // Extract by version |
|
449 | + ['v', $this->bits], // General purpose bit flags - data descriptor flag set |
|
450 | + ['v', $this->method->getValue()], // Compression method |
|
451 | + ['V', $time], // Timestamp (DOS Format) |
|
452 | + ['V', $this->crc], // CRC32 |
|
453 | + ['V', $this->zlen->getLowFF()], // Compressed Data Length |
|
454 | + ['V', $this->len->getLowFF()], // Original Data Length |
|
455 | + ['v', \strlen($name)], // Length of filename |
|
456 | + ['v', \strlen($footer)], // Extra data len (see above) |
|
457 | + ['v', \strlen($comment)], // Length of comment |
|
458 | + ['v', 0], // Disk number |
|
459 | + ['v', 0], // Internal File Attributes |
|
460 | + ['V', 32], // External File Attributes |
|
461 | 461 | ['V', $this->ofs->getLowFF()] // Relative offset of local header |
462 | 462 | ]; |
463 | 463 | |
464 | 464 | // pack fields, then append name and comment |
465 | 465 | $header = ZipStream::packFields($fields); |
466 | 466 | |
467 | - return $header . $name . $footer . $comment; |
|
467 | + return $header.$name.$footer.$comment; |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | /** |
@@ -21,7 +21,7 @@ |
||
21 | 21 | */ |
22 | 22 | public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise |
23 | 23 | { |
24 | - return $next($request)->then(function (ResponseInterface $response) { |
|
24 | + return $next($request)->then(function(ResponseInterface $response) { |
|
25 | 25 | if ($response->getBody()->isSeekable()) { |
26 | 26 | return $response; |
27 | 27 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | $encodings[] = 'chunked'; |
62 | 62 | $request = $request->withHeader('TE', $encodings); |
63 | 63 | |
64 | - return $next($request)->then(function (ResponseInterface $response) { |
|
64 | + return $next($request)->then(function(ResponseInterface $response) { |
|
65 | 65 | return $this->decodeResponse($response); |
66 | 66 | }); |
67 | 67 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | { |
62 | 62 | $promise = $next($request); |
63 | 63 | |
64 | - return $promise->then(function (ResponseInterface $response) use ($request) { |
|
64 | + return $promise->then(function(ResponseInterface $response) use ($request) { |
|
65 | 65 | return $this->transformResponseToException($request, $response); |
66 | 66 | }); |
67 | 67 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | */ |
45 | 45 | public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise |
46 | 46 | { |
47 | - $addHostNext = function (RequestInterface $request) use ($next, $first) { |
|
47 | + $addHostNext = function(RequestInterface $request) use ($next, $first) { |
|
48 | 48 | return $this->addHostPlugin->handleRequest($request, $next, $first); |
49 | 49 | }; |
50 | 50 |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | ]); |
118 | 118 | $resolver->setAllowedTypes('preserve_header', ['bool', 'array']); |
119 | 119 | $resolver->setAllowedTypes('use_default_for_multiple', 'bool'); |
120 | - $resolver->setNormalizer('preserve_header', function (OptionsResolver $resolver, $value) { |
|
120 | + $resolver->setNormalizer('preserve_header', function(OptionsResolver $resolver, $value) { |
|
121 | 121 | if (\is_bool($value) && false === $value) { |
122 | 122 | return []; |
123 | 123 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | return $first($redirectRequest); |
145 | 145 | } |
146 | 146 | |
147 | - return $next($request)->then(function (ResponseInterface $response) use ($request, $first): ResponseInterface { |
|
147 | + return $next($request)->then(function(ResponseInterface $response) use ($request, $first): ResponseInterface { |
|
148 | 148 | $statusCode = $response->getStatusCode(); |
149 | 149 | |
150 | 150 | if (!\array_key_exists($statusCode, $this->redirectCodes)) { |