@@ -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)) { |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | $resolver = new OptionsResolver(); |
| 71 | 71 | $resolver->setDefaults([ |
| 72 | 72 | 'retries' => 1, |
| 73 | - 'error_response_decider' => function (RequestInterface $request, ResponseInterface $response) { |
|
| 73 | + 'error_response_decider' => function(RequestInterface $request, ResponseInterface $response) { |
|
| 74 | 74 | // do not retry client errors |
| 75 | 75 | return $response->getStatusCode() >= 500 && $response->getStatusCode() < 600; |
| 76 | 76 | }, |
| 77 | - 'exception_decider' => function (RequestInterface $request, ClientExceptionInterface $e) { |
|
| 77 | + 'exception_decider' => function(RequestInterface $request, ClientExceptionInterface $e) { |
|
| 78 | 78 | // do not retry client errors |
| 79 | 79 | return !$e instanceof HttpException || $e->getCode() >= 500 && $e->getCode() < 600; |
| 80 | 80 | }, |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | $chainIdentifier = spl_object_hash((object) $first); |
| 105 | 105 | |
| 106 | - return $next($request)->then(function (ResponseInterface $response) use ($request, $next, $first, $chainIdentifier) { |
|
| 106 | + return $next($request)->then(function(ResponseInterface $response) use ($request, $next, $first, $chainIdentifier) { |
|
| 107 | 107 | if (!\array_key_exists($chainIdentifier, $this->retryStorage)) { |
| 108 | 108 | $this->retryStorage[$chainIdentifier] = 0; |
| 109 | 109 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | return $response; |
| 127 | - }, function (ClientExceptionInterface $exception) use ($request, $next, $first, $chainIdentifier) { |
|
| 127 | + }, function(ClientExceptionInterface $exception) use ($request, $next, $first, $chainIdentifier) { |
|
| 128 | 128 | if (!\array_key_exists($chainIdentifier, $this->retryStorage)) { |
| 129 | 129 | $this->retryStorage[$chainIdentifier] = 0; |
| 130 | 130 | } |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | $request = $request->withAddedHeader('Cookie', \implode('; ', array_unique($cookies))); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - return $next($request)->then(function (ResponseInterface $response) use ($request) { |
|
| 66 | + return $next($request)->then(function(ResponseInterface $response) use ($request) { |
|
| 67 | 67 | if ($response->hasHeader('Set-Cookie')) { |
| 68 | 68 | $setCookies = $response->getHeader('Set-Cookie'); |
| 69 | 69 | |
@@ -36,11 +36,11 @@ |
||
| 36 | 36 | { |
| 37 | 37 | $journal = $this->journal; |
| 38 | 38 | |
| 39 | - return $next($request)->then(function (ResponseInterface $response) use ($request, $journal) { |
|
| 39 | + return $next($request)->then(function(ResponseInterface $response) use ($request, $journal) { |
|
| 40 | 40 | $journal->addSuccess($request, $response); |
| 41 | 41 | |
| 42 | 42 | return $response; |
| 43 | - }, function (ClientExceptionInterface $exception) use ($request, $journal) { |
|
| 43 | + }, function(ClientExceptionInterface $exception) use ($request, $journal) { |
|
| 44 | 44 | $journal->addFailure($request, $exception); |
| 45 | 45 | |
| 46 | 46 | throw $exception; |