@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $protocol = $server['SERVER_PROTOCOL'] ?? '1.1'; |
| 43 | - $protocol = str_replace('HTTP/', '', $protocol); |
|
| 43 | + $protocol = str_replace('HTTP/', '', $protocol); |
|
| 44 | 44 | |
| 45 | - if (! ($uri instanceof UriInterface)) { |
|
| 45 | + if (!($uri instanceof UriInterface)) { |
|
| 46 | 46 | $uriFactory = new UriFactory(); |
| 47 | 47 | $uri = $uriFactory->createUri($uri); |
| 48 | 48 | } |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | $protocol, |
| 59 | 59 | $server, // from extract. |
| 60 | 60 | $cookie, // from extract. |
| 61 | - $post, // from extract. |
|
| 62 | - $get, // from extract. |
|
| 61 | + $post, // from extract. |
|
| 62 | + $get, // from extract. |
|
| 63 | 63 | $files // from extract. |
| 64 | 64 | ); |
| 65 | 65 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | // HTTP protocal version. |
| 86 | 86 | $protocol = $server['SERVER_PROTOCOL'] ?? '1.1'; |
| 87 | - $protocol = str_replace('HTTP/', '', $protocol); |
|
| 87 | + $protocol = str_replace('HTTP/', '', $protocol); |
|
| 88 | 88 | |
| 89 | 89 | $uri = UriFactory::fromGlobal(); |
| 90 | 90 | |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | $protocol, |
| 100 | 100 | $server, // from extract. |
| 101 | 101 | $cookie, // from extract. |
| 102 | - $post, // from extract. |
|
| 103 | - $get, // from extract. |
|
| 102 | + $post, // from extract. |
|
| 103 | + $get, // from extract. |
|
| 104 | 104 | $files // from extract. |
| 105 | 105 | ); |
| 106 | 106 | } |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | extract(SuperGlobal::extract()); |
| 35 | 35 | |
| 36 | 36 | $protocol = $server['SERVER_PROTOCOL'] ?? '1.1'; |
| 37 | - $protocol = str_replace('HTTP/', '', $protocol); |
|
| 37 | + $protocol = str_replace('HTTP/', '', $protocol); |
|
| 38 | 38 | |
| 39 | 39 | $streamFactory = new streamFactory(); |
| 40 | 40 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | string $clientMediaType = null |
| 35 | 35 | ): UploadedFileInterface |
| 36 | 36 | { |
| 37 | - if (! $stream->isReadable()) { |
|
| 37 | + if (!$stream->isReadable()) { |
|
| 38 | 38 | throw new InvalidArgumentException( |
| 39 | 39 | 'File is not readable.' |
| 40 | 40 | ); |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | extract(SuperGlobal::extract()); |
| 36 | 36 | |
| 37 | 37 | $protocol = $server['SERVER_PROTOCOL'] ?? '1.1'; |
| 38 | - $protocol = str_replace('HTTP/', '', $protocol); |
|
| 38 | + $protocol = str_replace('HTTP/', '', $protocol); |
|
| 39 | 39 | |
| 40 | 40 | $uriFactory = new UriFactory(); |
| 41 | 41 | $streamFactory = new StreamFactory(); |
@@ -70,10 +70,10 @@ |
||
| 70 | 70 | */ |
| 71 | 71 | public static function mockCliEnvironment(array $server = []): void |
| 72 | 72 | { |
| 73 | - $_POST = $_POST ?? []; |
|
| 73 | + $_POST = $_POST ?? []; |
|
| 74 | 74 | $_COOKIE = $_COOKIE ?? []; |
| 75 | - $_GET = $_GET ?? []; |
|
| 76 | - $_FILES = $_FILES ?? []; |
|
| 75 | + $_GET = $_GET ?? []; |
|
| 76 | + $_FILES = $_FILES ?? []; |
|
| 77 | 77 | $_SERVER = $_SERVER ?? []; |
| 78 | 78 | |
| 79 | 79 | $defaultServerParams = [ |
@@ -25,5 +25,5 @@ |
||
| 25 | 25 | /** |
| 26 | 26 | * {@inheritdoc} |
| 27 | 27 | */ |
| 28 | - abstract function process(ServerRequestInterface $request,RequestHandlerInterface $handler): ResponseInterface; |
|
| 28 | + abstract function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface; |
|
| 29 | 29 | } |
| 30 | 30 | \ No newline at end of file |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | */ |
| 83 | 83 | protected function final(ServerRequestInterface $request): ResponseInterface |
| 84 | 84 | { |
| 85 | - if (! $this->fallbackHandler) { |
|
| 85 | + if (!$this->fallbackHandler) { |
|
| 86 | 86 | return new Response(); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | $num = count($headers); |
| 283 | 283 | |
| 284 | 284 | if ($num > 1) { |
| 285 | - $headers = array_merge(...array_map(function ($line) { |
|
| 285 | + $headers = array_merge(...array_map(function($line) { |
|
| 286 | 286 | $name = trim($line[1]); |
| 287 | 287 | $field = trim($line[2]); |
| 288 | 288 | return [$name => $field]; |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | // digit => 0-9 |
| 360 | 360 | // others => !#$%&\'*+-.^_`|~ |
| 361 | 361 | |
| 362 | - if (! preg_match('/^[a-zA-Z0-9!#$%&\'*+-.^_`|~]+$/', $name)) { |
|
| 362 | + if (!preg_match('/^[a-zA-Z0-9!#$%&\'*+-.^_`|~]+$/', $name)) { |
|
| 363 | 363 | throw new InvalidArgumentException( |
| 364 | 364 | sprintf( |
| 365 | 365 | '"%s" is not valid header name, it must be an RFC 7230 compatible string.', |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | { |
| 383 | 383 | if (is_array($value)) { |
| 384 | 384 | foreach ($value as $item) { |
| 385 | - if (! is_scalar($item) || is_bool($item)) { |
|
| 385 | + if (!is_scalar($item) || is_bool($item)) { |
|
| 386 | 386 | throw new InvalidArgumentException( |
| 387 | 387 | sprintf( |
| 388 | 388 | 'The header values only accept string and number, but "%s" provided.', |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | |
| 403 | 403 | // I THINK THAT obs-text SHOULD N0T BE USED. |
| 404 | 404 | // OR EVEN I CAN PASS CHINESE CHARACTERS, THAT'S WEIRD. |
| 405 | - if (! preg_match('/^[ \t\x21-\x7e]+$/', $item)) { |
|
| 405 | + if (!preg_match('/^[ \t\x21-\x7e]+$/', $item)) { |
|
| 406 | 406 | throw new InvalidArgumentException( |
| 407 | 407 | sprintf( |
| 408 | 408 | '"%s" is not valid header value, it must contains visible ASCII characters only.', |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | */ |
| 433 | 433 | protected function assertProtocolVersion(string $version): void |
| 434 | 434 | { |
| 435 | - if (! in_array($version, $this->validProtocolVersions)) { |
|
| 435 | + if (!in_array($version, $this->validProtocolVersions)) { |
|
| 436 | 436 | throw new InvalidArgumentException( |
| 437 | 437 | sprintf( |
| 438 | 438 | 'Unsupported HTTP protocol version number. "%s" provided.', |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $authority .= $this->getHost(); |
| 147 | 147 | |
| 148 | - if (! empty($this->getPort())) { |
|
| 148 | + if (!empty($this->getPort())) { |
|
| 149 | 149 | $authority .= ':' . $this->getPort(); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | { |
| 160 | 160 | $userInfo = $this->user; |
| 161 | 161 | |
| 162 | - if (! empty($this->pass)) { |
|
| 162 | + if (!empty($this->pass)) { |
|
| 163 | 163 | $userInfo .= ':' . $this->pass; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | 'fragment' |
| 379 | 379 | ]; |
| 380 | 380 | |
| 381 | - foreach($components as $v) { |
|
| 381 | + foreach ($components as $v) { |
|
| 382 | 382 | $this->{$v} = isset($data[$v]) ? $this->filter($v, $data[$v]) : ''; |
| 383 | 383 | } |
| 384 | 384 | |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | if ($regex) { |
| 440 | 440 | return preg_replace_callback( |
| 441 | 441 | $regex, |
| 442 | - function ($match) { |
|
| 442 | + function($match) { |
|
| 443 | 443 | return rawurlencode($match[0]); |
| 444 | 444 | }, |
| 445 | 445 | $value |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | 2 => 'https', |
| 469 | 469 | ]; |
| 470 | 470 | |
| 471 | - if (! in_array($scheme, $validSchemes)) { |
|
| 471 | + if (!in_array($scheme, $validSchemes)) { |
|
| 472 | 472 | throw new InvalidArgumentException( |
| 473 | 473 | sprintf( |
| 474 | 474 | 'The string "%s" is not a valid scheme.', |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | */ |
| 491 | 491 | protected function assertString($value, string $name = 'it'): void |
| 492 | 492 | { |
| 493 | - if (! is_string($value)) { |
|
| 493 | + if (!is_string($value)) { |
|
| 494 | 494 | throw new InvalidArgumentException( |
| 495 | 495 | sprintf( |
| 496 | 496 | ucfirst($name) . ' must be a string, but %s provided.', |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | { |
| 514 | 514 | $this->assertString($uri, 'uri'); |
| 515 | 515 | |
| 516 | - if (! filter_var($uri, FILTER_VALIDATE_URL)) { |
|
| 516 | + if (!filter_var($uri, FILTER_VALIDATE_URL)) { |
|
| 517 | 517 | throw new InvalidArgumentException( |
| 518 | 518 | sprintf( |
| 519 | 519 | '"%s" is not a valid URI', |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | return; |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | - if (! filter_var($host, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) { |
|
| 545 | + if (!filter_var($host, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) { |
|
| 546 | 546 | throw new InvalidArgumentException( |
| 547 | 547 | sprintf( |
| 548 | 548 | '"%s" is not a valid host', |
@@ -564,8 +564,8 @@ discard block |
||
| 564 | 564 | protected function assertPort($port): void |
| 565 | 565 | { |
| 566 | 566 | if ( |
| 567 | - ! is_null($port) && |
|
| 568 | - ! is_integer($port) |
|
| 567 | + !is_null($port) && |
|
| 568 | + !is_integer($port) |
|
| 569 | 569 | ) { |
| 570 | 570 | throw new InvalidArgumentException( |
| 571 | 571 | sprintf( |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | ); |
| 576 | 576 | } |
| 577 | 577 | |
| 578 | - if (! ($port > 0 && $port < 65535)) { |
|
| 578 | + if (!($port > 0 && $port < 65535)) { |
|
| 579 | 579 | throw new InvalidArgumentException( |
| 580 | 580 | sprintf( |
| 581 | 581 | 'Port number should be in a range of 0-65535, but %s provided.', |