@@ -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 @@ 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.', |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | public function detach() |
| 156 | 156 | { |
| 157 | - if (! isset($this->stream) || ! $this->stream) { |
|
| 157 | + if (!isset($this->stream) || !$this->stream) { |
|
| 158 | 158 | return null; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public function getSize() |
| 178 | 178 | { |
| 179 | - if (! isset($this->stream) || ! $this->stream) { |
|
| 179 | + if (!isset($this->stream) || !$this->stream) { |
|
| 180 | 180 | return null; |
| 181 | 181 | } |
| 182 | 182 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public function tell(): int |
| 198 | 198 | { |
| 199 | - if (! isset($this->stream) || ! $this->stream) { |
|
| 199 | + if (!isset($this->stream) || !$this->stream) { |
|
| 200 | 200 | throw new RuntimeException( |
| 201 | 201 | 'Stream does not exist.' |
| 202 | 202 | ); |
@@ -235,11 +235,11 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | public function seek($offset, $whence = SEEK_SET): void |
| 237 | 237 | { |
| 238 | - if (! isset($this->stream) || ! $this->stream) { |
|
| 238 | + if (!isset($this->stream) || !$this->stream) { |
|
| 239 | 239 | throw new RuntimeException('Stream does not exist.'); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - if (! $this->seekable) { |
|
| 242 | + if (!$this->seekable) { |
|
| 243 | 243 | throw new RuntimeException( |
| 244 | 244 | 'Stream is not seekable.' |
| 245 | 245 | ); |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | */ |
| 296 | 296 | public function write($string): int |
| 297 | 297 | { |
| 298 | - if (! isset($this->stream) || ! $this->stream) { |
|
| 298 | + if (!isset($this->stream) || !$this->stream) { |
|
| 299 | 299 | throw new RuntimeException( |
| 300 | 300 | 'Stream does not exist.' |
| 301 | 301 | ); |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | */ |
| 330 | 330 | public function read($length): string |
| 331 | 331 | { |
| 332 | - if (! isset($this->stream) || ! $this->stream) { |
|
| 332 | + if (!isset($this->stream) || !$this->stream) { |
|
| 333 | 333 | throw new RuntimeException( |
| 334 | 334 | 'Stream does not exist.' |
| 335 | 335 | ); |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | */ |
| 361 | 361 | public function getContents(): string |
| 362 | 362 | { |
| 363 | - if (! isset($this->stream) || ! $this->stream) { |
|
| 363 | + if (!isset($this->stream) || !$this->stream) { |
|
| 364 | 364 | throw new RuntimeException( |
| 365 | 365 | 'Stream does not exist.' |
| 366 | 366 | ); |
@@ -386,10 +386,10 @@ discard block |
||
| 386 | 386 | */ |
| 387 | 387 | public function getMetadata($key = null) |
| 388 | 388 | { |
| 389 | - if (! empty($this->stream)) { |
|
| 389 | + if (!empty($this->stream)) { |
|
| 390 | 390 | $this->meta = stream_get_meta_data($this->stream); |
| 391 | 391 | |
| 392 | - if (! $key) { |
|
| 392 | + if (!$key) { |
|
| 393 | 393 | return $this->meta; |
| 394 | 394 | } |
| 395 | 395 | |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | */ |
| 431 | 431 | protected function assertStream($stream): void |
| 432 | 432 | { |
| 433 | - if (! is_resource($stream)) { |
|
| 433 | + if (!is_resource($stream)) { |
|
| 434 | 434 | throw new InvalidArgumentException( |
| 435 | 435 | sprintf( |
| 436 | 436 | 'Stream should be a resource, but "%s" provided.', |
@@ -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 | ); |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | if ($this->isFile()) { |
| 176 | 176 | |
| 177 | - if (! is_writable(dirname($targetPath))) { |
|
| 177 | + if (!is_writable(dirname($targetPath))) { |
|
| 178 | 178 | throw new RuntimeException( |
| 179 | 179 | sprintf( |
| 180 | 180 | 'The target path "%s" is not writable.', |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | if ($this->sapi === 'cli') { |
| 187 | 187 | |
| 188 | - if (! $this->rename($this->file, $targetPath)) { |
|
| 188 | + if (!$this->rename($this->file, $targetPath)) { |
|
| 189 | 189 | throw new RuntimeException( |
| 190 | 190 | sprintf( |
| 191 | 191 | 'Could not rename the file to the target path "%s".', |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | } else { |
| 197 | 197 | |
| 198 | - if (! $this->isUploadedFile($this->file)) { |
|
| 198 | + if (!$this->isUploadedFile($this->file)) { |
|
| 199 | 199 | throw new RuntimeException( |
| 200 | 200 | sprintf( |
| 201 | 201 | '"%s" is invalid uploaded file.', |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | ); |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - if (! $this->moveUploadedFile($this->file, $targetPath)) { |
|
| 207 | + if (!$this->moveUploadedFile($this->file, $targetPath)) { |
|
| 208 | 208 | throw new RuntimeException( |
| 209 | 209 | sprintf( |
| 210 | 210 | 'Could not move the file to the target path "%s".', |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | // @codeCoverageIgnoreStart |
| 223 | 223 | |
| 224 | - if (! file_exists($targetPath)) { |
|
| 224 | + if (!file_exists($targetPath)) { |
|
| 225 | 225 | throw new RuntimeException( |
| 226 | 226 | sprintf( |
| 227 | 227 | 'Could not move the stream to the target path "%s".', |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | */ |
| 343 | 343 | protected function isFile(): bool |
| 344 | 344 | { |
| 345 | - return (is_string($this->file) && ! empty($this->file)); |
|
| 345 | + return (is_string($this->file) && !empty($this->file)); |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | /** |
@@ -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 = [] , |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function __construct( |
| 98 | 98 | string $method = 'GET', |
| 99 | - $uri = '' , |
|
| 100 | - $body = '' , |
|
| 101 | - array $headers = [] , |
|
| 99 | + $uri = '', |
|
| 100 | + $body = '', |
|
| 101 | + array $headers = [], |
|
| 102 | 102 | string $version = '1.1', |
| 103 | - array $serverParams = [] , |
|
| 104 | - array $cookieParams = [] , |
|
| 105 | - array $postParams = [] , |
|
| 106 | - array $getParams = [] , |
|
| 103 | + array $serverParams = [], |
|
| 104 | + array $cookieParams = [], |
|
| 105 | + array $postParams = [], |
|
| 106 | + array $getParams = [], |
|
| 107 | 107 | array $filesParams = [] |
| 108 | 108 | ) { |
| 109 | 109 | parent::__construct($method, $uri, $body, $headers, $version); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | // the UploadedFile instance(s) as the $filesParams is given. |
| 119 | 119 | $this->uploadedFiles = []; |
| 120 | 120 | |
| 121 | - if (! empty($filesParams)) { |
|
| 121 | + if (!empty($filesParams)) { |
|
| 122 | 122 | $this->uploadedFiles = self::uploadedFileSpecsConvert( |
| 123 | 123 | self::uploadedFileParse($filesParams) |
| 124 | 124 | ); |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | |
| 364 | 364 | if (is_array($values)) { |
| 365 | 365 | |
| 366 | - foreach($values as $key => $value) { |
|
| 366 | + foreach ($values as $key => $value) { |
|
| 367 | 367 | |
| 368 | 368 | // Restore the keys back to the original ones. |
| 369 | 369 | $key = rtrim($key, '_'); |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | foreach ($values as $value) { |
| 436 | 436 | if (is_array($value)) { |
| 437 | 437 | $this->assertUploadedFiles($value); |
| 438 | - } elseif (! ($value instanceof UploadedFileInterface)) { |
|
| 438 | + } elseif (!($value instanceof UploadedFileInterface)) { |
|
| 439 | 439 | throw new InvalidArgumentException( |
| 440 | 440 | 'Invalid PSR-7 array structure for handling UploadedFile.' |
| 441 | 441 | ); |
@@ -457,9 +457,9 @@ discard block |
||
| 457 | 457 | protected function assertParsedBody($data): void |
| 458 | 458 | { |
| 459 | 459 | if ( |
| 460 | - ! is_null($data) && |
|
| 461 | - ! is_array($data) && |
|
| 462 | - ! is_object($data) |
|
| 460 | + !is_null($data) && |
|
| 461 | + !is_array($data) && |
|
| 462 | + !is_object($data) |
|
| 463 | 463 | ) { |
| 464 | 464 | throw new InvalidArgumentException( |
| 465 | 465 | sprintf( |