@@ -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 @@ discard block |
||
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->assertMethod($method); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $path = '/'; |
154 | 154 | } |
155 | 155 | |
156 | - if (! empty($query)) { |
|
156 | + if (!empty($query)) { |
|
157 | 157 | $path .= '?' . $query; |
158 | 158 | } |
159 | 159 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function withRequestTarget($requestTarget) |
167 | 167 | { |
168 | - if (! is_string($requestTarget)) { |
|
168 | + if (!is_string($requestTarget)) { |
|
169 | 169 | throw new InvalidArgumentException( |
170 | 170 | 'A request target must be a string.' |
171 | 171 | ); |
@@ -222,13 +222,13 @@ discard block |
||
222 | 222 | if ( |
223 | 223 | // This method MUST update the Host header of the returned request by |
224 | 224 | // default if the URI contains a host component. |
225 | - (! $preserveHost && $host !== '') || |
|
225 | + (!$preserveHost && $host !== '') || |
|
226 | 226 | |
227 | 227 | // When `$preserveHost` is set to `true`. |
228 | 228 | // If the Host header is missing or empty, and the new URI contains |
229 | 229 | // a host component, this method MUST update the Host header in the returned |
230 | 230 | // request. |
231 | - ($preserveHost && ! $this->hasHeader('Host') && $host !== '') |
|
231 | + ($preserveHost && !$this->hasHeader('Host') && $host !== '') |
|
232 | 232 | ) { |
233 | 233 | $clone = clone $this; |
234 | 234 | $clone->uri = $uri; |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | { |
262 | 262 | $this->method = strtoupper($method); |
263 | 263 | |
264 | - if (! in_array($this->method, $this->validMethods)) { |
|
264 | + if (!in_array($this->method, $this->validMethods)) { |
|
265 | 265 | throw new InvalidArgumentException( |
266 | 266 | sprintf( |
267 | 267 | 'Unsupported HTTP method. It must be compatible with RFC-7231 request method, but "%s" provided.', |
@@ -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 = []; |
@@ -132,7 +132,7 @@ |
||
132 | 132 | |
133 | 133 | if (is_array($values)) { |
134 | 134 | |
135 | - foreach($values as $key => $value) { |
|
135 | + foreach ($values as $key => $value) { |
|
136 | 136 | |
137 | 137 | // Restore the keys back to the original ones. |
138 | 138 | $key = rtrim($key, '_'); |
@@ -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( |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function detach() |
149 | 149 | { |
150 | - if (! $this->isStream()) { |
|
150 | + if (!$this->isStream()) { |
|
151 | 151 | return null; |
152 | 152 | } |
153 | 153 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function getSize() |
171 | 171 | { |
172 | - if (! $this->isStream()) { |
|
172 | + if (!$this->isStream()) { |
|
173 | 173 | return null; |
174 | 174 | } |
175 | 175 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | { |
224 | 224 | $this->assertPropertyStream(); |
225 | 225 | |
226 | - if (! $this->seekable) { |
|
226 | + if (!$this->seekable) { |
|
227 | 227 | throw new RuntimeException( |
228 | 228 | 'Stream is not seekable.' |
229 | 229 | ); |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | if ($this->isStream()) { |
347 | 347 | $this->meta = stream_get_meta_data($this->stream); |
348 | 348 | |
349 | - if (! $key) { |
|
349 | + if (!$key) { |
|
350 | 350 | return $this->meta; |
351 | 351 | } |
352 | 352 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | */ |
388 | 388 | protected function assertStream($stream): void |
389 | 389 | { |
390 | - if (! is_resource($stream)) { |
|
390 | + if (!is_resource($stream)) { |
|
391 | 391 | throw new InvalidArgumentException( |
392 | 392 | sprintf( |
393 | 393 | 'Stream should be a resource, but "%s" provided.', |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | */ |
406 | 406 | protected function assertPropertyStream(): void |
407 | 407 | { |
408 | - if (! $this->isStream()) { |
|
408 | + if (!$this->isStream()) { |
|
409 | 409 | throw new RuntimeException( |
410 | 410 | 'Stream does not exist.' |
411 | 411 | ); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface |
51 | 51 | { |
52 | - if ($mode === '' || ! preg_match('/^[rwaxce]{1}[bt]{0,1}[+]{0,1}+$/', $mode)) { |
|
52 | + if ($mode === '' || !preg_match('/^[rwaxce]{1}[bt]{0,1}[+]{0,1}+$/', $mode)) { |
|
53 | 53 | throw new InvalidArgumentException( |
54 | 54 | sprintf( |
55 | 55 | 'Invalid file opening mode "%s"', |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $resource = @fopen($filename, $mode); |
62 | 62 | |
63 | - if (! is_resource($resource)) { |
|
63 | + if (!is_resource($resource)) { |
|
64 | 64 | throw new RuntimeException( |
65 | 65 | sprintf( |
66 | 66 | 'Unable to open file at "%s"', |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function createStreamFromResource($resource): StreamInterface |
79 | 79 | { |
80 | - if (! is_resource($resource)) { |
|
80 | + if (!is_resource($resource)) { |
|
81 | 81 | $resource = @fopen('php://temp', 'r+'); |
82 | 82 | } |
83 | 83 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | protected function assertResource($resource) |
97 | 97 | { |
98 | - if (! is_resource($resource)) { |
|
98 | + if (!is_resource($resource)) { |
|
99 | 99 | throw new RuntimeException( |
100 | 100 | 'Unable to open "php://temp" resource.' |
101 | 101 | ); |