@@ -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); |
@@ -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 |
@@ -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 @@ discard block |
||
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 | ) { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | protected function assertStatus($code) |
213 | 213 | { |
214 | - if (! is_integer($code)) { |
|
214 | + if (!is_integer($code)) { |
|
215 | 215 | throw new InvalidArgumentException( |
216 | 216 | sprintf( |
217 | 217 | 'Status code should be an integer value, but "%s" provided.', |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | ); |
221 | 221 | } |
222 | 222 | |
223 | - if (! ($code > 100 && $code < 599)) { |
|
223 | + if (!($code > 100 && $code < 599)) { |
|
224 | 224 | throw new InvalidArgumentException( |
225 | 225 | sprintf( |
226 | 226 | 'Status code should be in a range of 100-599, but "%s" provided.', |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | return; |
246 | 246 | } |
247 | 247 | |
248 | - if (! is_string($reasonPhrase)) { |
|
248 | + if (!is_string($reasonPhrase)) { |
|
249 | 249 | throw new InvalidArgumentException( |
250 | 250 | sprintf( |
251 | 251 | 'Reason phrase must be a string, but "%s" provided.', |
@@ -107,8 +107,8 @@ |
||
107 | 107 | */ |
108 | 108 | public function __construct( |
109 | 109 | string $method = 'GET', |
110 | - $uri = '' , |
|
111 | - $body = '' , |
|
110 | + $uri = '' , |
|
111 | + $body = '' , |
|
112 | 112 | array $headers = [] , |
113 | 113 | string $version = '1.1' |
114 | 114 | ) { |
@@ -107,9 +107,9 @@ |
||
107 | 107 | */ |
108 | 108 | public function __construct( |
109 | 109 | string $method = 'GET', |
110 | - $uri = '' , |
|
111 | - $body = '' , |
|
112 | - array $headers = [] , |
|
110 | + $uri = '', |
|
111 | + $body = '', |
|
112 | + array $headers = [], |
|
113 | 113 | string $version = '1.1' |
114 | 114 | ) { |
115 | 115 | $this->method = $method; |
@@ -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 = [] , |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function __construct( |
96 | 96 | string $method = 'GET', |
97 | - $uri = '' , |
|
98 | - $body = '' , |
|
99 | - array $headers = [] , |
|
97 | + $uri = '', |
|
98 | + $body = '', |
|
99 | + array $headers = [], |
|
100 | 100 | string $version = '1.1', |
101 | - array $serverParams = [] , |
|
102 | - array $cookieParams = [] , |
|
103 | - array $postParams = [] , |
|
104 | - array $getParams = [] , |
|
101 | + array $serverParams = [], |
|
102 | + array $cookieParams = [], |
|
103 | + array $postParams = [], |
|
104 | + array $getParams = [], |
|
105 | 105 | array $filesParams = [] |
106 | 106 | ) { |
107 | 107 | parent::__construct($method, $uri, $body, $headers, $version); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | // the UploadedFile instance(s) as the $filesParams is given. |
117 | 117 | $this->uploadedFiles = []; |
118 | 118 | |
119 | - if (! empty($filesParams)) { |
|
119 | + if (!empty($filesParams)) { |
|
120 | 120 | $this->uploadedFiles = UploadedFileHelper::uploadedFileSpecsConvert( |
121 | 121 | UploadedFileHelper::uploadedFileParse($filesParams) |
122 | 122 | ); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | foreach ($values as $value) { |
273 | 273 | if (is_array($value)) { |
274 | 274 | $this->assertUploadedFiles($value); |
275 | - } elseif (! ($value instanceof UploadedFileInterface)) { |
|
275 | + } elseif (!($value instanceof UploadedFileInterface)) { |
|
276 | 276 | throw new InvalidArgumentException( |
277 | 277 | 'Invalid PSR-7 array structure for handling UploadedFile.' |
278 | 278 | ); |
@@ -293,9 +293,9 @@ discard block |
||
293 | 293 | protected function assertParsedBody($data): void |
294 | 294 | { |
295 | 295 | if ( |
296 | - ! is_null($data) && |
|
297 | - ! is_array($data) && |
|
298 | - ! is_object($data) |
|
296 | + !is_null($data) && |
|
297 | + !is_array($data) && |
|
298 | + !is_object($data) |
|
299 | 299 | ) { |
300 | 300 | throw new InvalidArgumentException( |
301 | 301 | 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 = []; |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | * @param string|null $sapi Only assign for unit testing purpose. |
111 | 111 | */ |
112 | 112 | public function __construct( |
113 | - $source , |
|
113 | + $source, |
|
114 | 114 | ?string $name = null, |
115 | 115 | ?string $type = null, |
116 | 116 | ?int $size = null, |
117 | - int $error = 0 , |
|
117 | + int $error = 0, |
|
118 | 118 | ?string $sapi = null |
119 | 119 | ) { |
120 | 120 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | ); |
153 | 153 | } |
154 | 154 | |
155 | - if (! $this->stream) { |
|
155 | + if (!$this->stream) { |
|
156 | 156 | throw new RuntimeException( |
157 | 157 | 'No stream is available or can be created.' |
158 | 158 | ); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | ); |
174 | 174 | } |
175 | 175 | |
176 | - if (! is_writable(dirname($targetPath))) { |
|
176 | + if (!is_writable(dirname($targetPath))) { |
|
177 | 177 | // Throw exception if the $targetPath specified is invalid. |
178 | 178 | throw new RuntimeException( |
179 | 179 | sprintf( |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | // Is a file.. |
187 | - if (is_string($this->file) && ! empty($this->file)) { |
|
187 | + if (is_string($this->file) && !empty($this->file)) { |
|
188 | 188 | |
189 | 189 | if ($this->sapi === 'cli') { |
190 | 190 | |
191 | - if (! rename($this->file, $targetPath)) { |
|
191 | + if (!rename($this->file, $targetPath)) { |
|
192 | 192 | |
193 | 193 | // @codeCoverageIgnoreStart |
194 | 194 | |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | } else { |
206 | 206 | |
207 | 207 | if ( |
208 | - ! is_uploaded_file($this->file) || |
|
209 | - ! move_uploaded_file($this->file, $targetPath) |
|
208 | + !is_uploaded_file($this->file) || |
|
209 | + !move_uploaded_file($this->file, $targetPath) |
|
210 | 210 | ) { |
211 | 211 | // Throw exception on any error during the move operation. |
212 | 212 | throw new RuntimeException( |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | // @codeCoverageIgnoreStart |
229 | 229 | |
230 | - if (! file_exists($targetPath)) { |
|
230 | + if (!file_exists($targetPath)) { |
|
231 | 231 | // Throw exception on any error during the move operation. |
232 | 232 | throw new RuntimeException( |
233 | 233 | sprintf( |