@@ -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 | |
@@ -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 = [ |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | ]; |
| 97 | 97 | |
| 98 | 98 | if (defined('NO_MOCK_ENV')) { |
| 99 | - $defaultServerParams = []; |
|
| 99 | + $defaultServerParams = []; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | $_SERVER = array_merge($defaultServerParams, $_SERVER, $server); |
@@ -143,7 +143,7 @@ |
||
| 143 | 143 | public function __construct( |
| 144 | 144 | int $status = 200 , |
| 145 | 145 | array $headers = [] , |
| 146 | - $body = '' , |
|
| 146 | + $body = '' , |
|
| 147 | 147 | string $version = '1.1', |
| 148 | 148 | string $reason = 'OK' |
| 149 | 149 | ) { |
@@ -141,9 +141,9 @@ |
||
| 141 | 141 | * @param string $reason Reaspnse HTTP reason phrase. |
| 142 | 142 | */ |
| 143 | 143 | public function __construct( |
| 144 | - int $status = 200 , |
|
| 145 | - array $headers = [] , |
|
| 146 | - $body = '' , |
|
| 144 | + int $status = 200, |
|
| 145 | + array $headers = [], |
|
| 146 | + $body = '', |
|
| 147 | 147 | string $version = '1.1', |
| 148 | 148 | string $reason = 'OK' |
| 149 | 149 | ) { |
@@ -96,8 +96,8 @@ |
||
| 96 | 96 | */ |
| 97 | 97 | public function __construct( |
| 98 | 98 | string $method = 'GET', |
| 99 | - $uri = '' , |
|
| 100 | - $body = '' , |
|
| 99 | + $uri = '' , |
|
| 100 | + $body = '' , |
|
| 101 | 101 | array $headers = [] , |
| 102 | 102 | string $version = '1.1', |
| 103 | 103 | array $serverParams = [] , |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function __construct( |
| 103 | 103 | string $method = 'GET', |
| 104 | - $uri = '' , |
|
| 105 | - $body = '' , |
|
| 106 | - array $headers = [] , |
|
| 104 | + $uri = '', |
|
| 105 | + $body = '', |
|
| 106 | + array $headers = [], |
|
| 107 | 107 | string $version = '1.1', |
| 108 | - array $serverParams = [] , |
|
| 109 | - array $cookieParams = [] , |
|
| 110 | - array $postParams = [] , |
|
| 111 | - array $getParams = [] , |
|
| 108 | + array $serverParams = [], |
|
| 109 | + array $cookieParams = [], |
|
| 110 | + array $postParams = [], |
|
| 111 | + array $getParams = [], |
|
| 112 | 112 | array $filesParams = [] |
| 113 | 113 | ) { |
| 114 | 114 | parent::__construct($method, $uri, $body, $headers, $version); |
@@ -301,9 +301,9 @@ discard block |
||
| 301 | 301 | protected function assertParsedBody($data): void |
| 302 | 302 | { |
| 303 | 303 | if ( |
| 304 | - ! is_null($data) && |
|
| 305 | - ! is_array($data) && |
|
| 306 | - ! is_object($data) |
|
| 304 | + !is_null($data) && |
|
| 305 | + !is_array($data) && |
|
| 306 | + !is_object($data) |
|
| 307 | 307 | ) { |
| 308 | 308 | throw new InvalidArgumentException( |
| 309 | 309 | sprintf( |
@@ -28,13 +28,13 @@ |
||
| 28 | 28 | class UploadedFileHelper |
| 29 | 29 | { |
| 30 | 30 | /** |
| 31 | - * Create an array for PSR-7 Uploaded File needed. |
|
| 32 | - * |
|
| 33 | - * @param array $files An array generally from $_FILES |
|
| 34 | - * @param bool $isConvert To covert and return $files as an UploadedFile instance. |
|
| 35 | - * |
|
| 36 | - * @return array|UploadedFile |
|
| 37 | - */ |
|
| 31 | + * Create an array for PSR-7 Uploaded File needed. |
|
| 32 | + * |
|
| 33 | + * @param array $files An array generally from $_FILES |
|
| 34 | + * @param bool $isConvert To covert and return $files as an UploadedFile instance. |
|
| 35 | + * |
|
| 36 | + * @return array|UploadedFile |
|
| 37 | + */ |
|
| 38 | 38 | public static function uploadedFileParse(array $files) |
| 39 | 39 | { |
| 40 | 40 | $specTree = []; |
@@ -40,7 +40,7 @@ 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 | 45 | if (!($uri instanceof UriInterface)) { |
| 46 | 46 | $uriFactory = new UriFactory(); |
@@ -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 | } |
@@ -439,7 +439,7 @@ |
||
| 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 |
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | * @param string|null $sapi Only assign for unit testing purpose. |
| 119 | 119 | */ |
| 120 | 120 | public function __construct( |
| 121 | - $source , |
|
| 121 | + $source, |
|
| 122 | 122 | ?string $name = null, |
| 123 | 123 | ?string $type = null, |
| 124 | 124 | ?int $size = null, |
| 125 | - int $error = 0 , |
|
| 125 | + int $error = 0, |
|
| 126 | 126 | ?string $sapi = null |
| 127 | 127 | ) { |
| 128 | 128 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | // Is a file.. |
| 203 | - if (is_string($this->file) && ! empty($this->file)) { |
|
| 203 | + if (is_string($this->file) && !empty($this->file)) { |
|
| 204 | 204 | |
| 205 | 205 | if ($this->sapi === 'cli') { |
| 206 | 206 | |
@@ -221,8 +221,8 @@ discard block |
||
| 221 | 221 | } else { |
| 222 | 222 | |
| 223 | 223 | if ( |
| 224 | - ! is_uploaded_file($this->file) || |
|
| 225 | - ! move_uploaded_file($this->file, $targetPath) |
|
| 224 | + !is_uploaded_file($this->file) || |
|
| 225 | + !move_uploaded_file($this->file, $targetPath) |
|
| 226 | 226 | ) { |
| 227 | 227 | // Throw exception on any error during the move operation. |
| 228 | 228 | throw new RuntimeException( |