@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | */ |
243 | 243 | public function withScheme($scheme) : UriInterface |
244 | 244 | { |
245 | - if (! is_string($scheme)) { |
|
245 | + if (!is_string($scheme)) { |
|
246 | 246 | throw new Exception\InvalidArgumentException(sprintf( |
247 | 247 | '%s expects a string argument; received %s', |
248 | 248 | __METHOD__, |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function withUserInfo($user, $password = null) : UriInterface |
275 | 275 | { |
276 | - if (! is_string($user)) { |
|
276 | + if (!is_string($user)) { |
|
277 | 277 | throw new Exception\InvalidArgumentException(sprintf( |
278 | 278 | '%s expects a string user argument; received %s', |
279 | 279 | __METHOD__, |
280 | 280 | is_object($user) ? get_class($user) : gettype($user) |
281 | 281 | )); |
282 | 282 | } |
283 | - if (null !== $password && ! is_string($password)) { |
|
283 | + if (null !== $password && !is_string($password)) { |
|
284 | 284 | throw new Exception\InvalidArgumentException(sprintf( |
285 | 285 | '%s expects a string or null password argument; received %s', |
286 | 286 | __METHOD__, |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public function withHost($host) : UriInterface |
311 | 311 | { |
312 | - if (! is_string($host)) { |
|
312 | + if (!is_string($host)) { |
|
313 | 313 | throw new Exception\InvalidArgumentException(sprintf( |
314 | 314 | '%s expects a string argument; received %s', |
315 | 315 | __METHOD__, |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | public function withPort($port) : UriInterface |
335 | 335 | { |
336 | 336 | if ($port !== null) { |
337 | - if (! is_numeric($port) || is_float($port)) { |
|
337 | + if (!is_numeric($port) || is_float($port)) { |
|
338 | 338 | throw new Exception\InvalidArgumentException(sprintf( |
339 | 339 | 'Invalid port "%s" specified; must be an integer, an integer string, or null', |
340 | 340 | is_object($port) ? get_class($port) : gettype($port) |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | */ |
368 | 368 | public function withPath($path) : UriInterface |
369 | 369 | { |
370 | - if (! is_string($path)) { |
|
370 | + if (!is_string($path)) { |
|
371 | 371 | throw new Exception\InvalidArgumentException( |
372 | 372 | 'Invalid path provided; must be a string' |
373 | 373 | ); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | */ |
404 | 404 | public function withQuery($query) : UriInterface |
405 | 405 | { |
406 | - if (! is_string($query)) { |
|
406 | + if (!is_string($query)) { |
|
407 | 407 | throw new Exception\InvalidArgumentException( |
408 | 408 | 'Query string must be a string' |
409 | 409 | ); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | */ |
434 | 434 | public function withFragment($fragment) : UriInterface |
435 | 435 | { |
436 | - if (! is_string($fragment)) { |
|
436 | + if (!is_string($fragment)) { |
|
437 | 437 | throw new Exception\InvalidArgumentException(sprintf( |
438 | 438 | '%s expects a string argument; received %s', |
439 | 439 | __METHOD__, |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | return false; |
532 | 532 | } |
533 | 533 | |
534 | - return ! isset($this->allowedSchemes[$scheme]) || $port !== $this->allowedSchemes[$scheme]; |
|
534 | + return !isset($this->allowedSchemes[$scheme]) || $port !== $this->allowedSchemes[$scheme]; |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | /** |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | return ''; |
550 | 550 | } |
551 | 551 | |
552 | - if (! isset($this->allowedSchemes[$scheme])) { |
|
552 | + if (!isset($this->allowedSchemes[$scheme])) { |
|
553 | 553 | throw new Exception\InvalidArgumentException(sprintf( |
554 | 554 | 'Unsupported scheme "%s"; must be any empty string or in the set (%s)', |
555 | 555 | $scheme, |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | private function splitQueryValue(string $value) : array |
640 | 640 | { |
641 | 641 | $data = explode('=', $value, 2); |
642 | - if (! isset($data[1])) { |
|
642 | + if (!isset($data[1])) { |
|
643 | 643 | $data[] = null; |
644 | 644 | } |
645 | 645 | return $data; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function __toString() : string |
75 | 75 | { |
76 | - if (! $this->isReadable()) { |
|
76 | + if (!$this->isReadable()) { |
|
77 | 77 | return ''; |
78 | 78 | } |
79 | 79 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function close() : void |
95 | 95 | { |
96 | - if (! $this->handle) { |
|
96 | + if (!$this->handle) { |
|
97 | 97 | return; |
98 | 98 | } |
99 | 99 | |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function tell() : int |
149 | 149 | { |
150 | - if (! $this->handle) { |
|
150 | + if (!$this->handle) { |
|
151 | 151 | throw Exception\UntellableStreamException::dueToMissingResource(); |
152 | 152 | } |
153 | 153 | |
154 | 154 | $result = ftell($this->handle); |
155 | - if (! is_int($result)) { |
|
155 | + if (!is_int($result)) { |
|
156 | 156 | throw Exception\UntellableStreamException::dueToPhpError(); |
157 | 157 | } |
158 | 158 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function eof() : bool |
166 | 166 | { |
167 | - if (! $this->handle) { |
|
167 | + if (!$this->handle) { |
|
168 | 168 | return true; |
169 | 169 | } |
170 | 170 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function isSeekable() : bool |
178 | 178 | { |
179 | - if (! $this->handle) { |
|
179 | + if (!$this->handle) { |
|
180 | 180 | return false; |
181 | 181 | } |
182 | 182 | |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function seek($offset, $whence = SEEK_SET) : void |
191 | 191 | { |
192 | - if (! $this->handle) { |
|
192 | + if (!$this->handle) { |
|
193 | 193 | throw Exception\UnseekableStreamException::dueToMissingResource(); |
194 | 194 | } |
195 | 195 | |
196 | - if (! $this->isSeekable()) { |
|
196 | + if (!$this->isSeekable()) { |
|
197 | 197 | throw Exception\UnseekableStreamException::dueToConfiguration(); |
198 | 198 | } |
199 | 199 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function isWritable() : bool |
219 | 219 | { |
220 | - if (! $this->handle) { |
|
220 | + if (!$this->handle) { |
|
221 | 221 | return false; |
222 | 222 | } |
223 | 223 | |
@@ -238,11 +238,11 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function write($data) : int |
240 | 240 | { |
241 | - if (! $this->handle) { |
|
241 | + if (!$this->handle) { |
|
242 | 242 | throw Exception\UnwritableStreamException::dueToMissingResource(); |
243 | 243 | } |
244 | 244 | |
245 | - if (! $this->isWritable()) { |
|
245 | + if (!$this->isWritable()) { |
|
246 | 246 | throw Exception\UnwritableStreamException::dueToConfiguration(); |
247 | 247 | } |
248 | 248 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function isReadable() : bool |
262 | 262 | { |
263 | - if (! $this->handle) { |
|
263 | + if (!$this->handle) { |
|
264 | 264 | return false; |
265 | 265 | } |
266 | 266 | |
@@ -275,11 +275,11 @@ discard block |
||
275 | 275 | */ |
276 | 276 | public function read($length) : string |
277 | 277 | { |
278 | - if (! $this->handle) { |
|
278 | + if (!$this->handle) { |
|
279 | 279 | throw Exception\UnreadableStreamException::dueToMissingResource(); |
280 | 280 | } |
281 | 281 | |
282 | - if (! $this->isReadable()) { |
|
282 | + if (!$this->isReadable()) { |
|
283 | 283 | throw Exception\UnreadableStreamException::dueToConfiguration(); |
284 | 284 | } |
285 | 285 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | */ |
298 | 298 | public function getContents() : string |
299 | 299 | { |
300 | - if (! $this->isReadable()) { |
|
300 | + if (!$this->isReadable()) { |
|
301 | 301 | throw Exception\UnreadableStreamException::dueToConfiguration(); |
302 | 302 | } |
303 | 303 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | } |
319 | 319 | |
320 | 320 | $metadata = stream_get_meta_data($this->handle); |
321 | - if (! array_key_exists($key, $metadata)) { |
|
321 | + if (!array_key_exists($key, $metadata)) { |
|
322 | 322 | return null; |
323 | 323 | } |
324 | 324 | |
@@ -334,11 +334,11 @@ discard block |
||
334 | 334 | */ |
335 | 335 | private function setStream($stream, string $mode = 'r') : void |
336 | 336 | { |
337 | - $error = null; |
|
337 | + $error = null; |
|
338 | 338 | $handle = $stream; |
339 | 339 | |
340 | 340 | if (is_string($stream)) { |
341 | - set_error_handler(function ($e) use (&$error) { |
|
341 | + set_error_handler(function($e) use (&$error) { |
|
342 | 342 | if ($e !== E_WARNING) { |
343 | 343 | return; |
344 | 344 | } |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | throw new Exception\InvalidArgumentException('Invalid stream reference provided'); |
354 | 354 | } |
355 | 355 | |
356 | - if (! is_resource($handle) || 'stream' !== get_resource_type($handle)) { |
|
356 | + if (!is_resource($handle) || 'stream' !== get_resource_type($handle)) { |
|
357 | 357 | throw new Exception\InvalidArgumentException( |
358 | 358 | 'Invalid stream provided; must be a string stream identifier or stream resource' |
359 | 359 | ); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function getHeader($header) : array |
144 | 144 | { |
145 | - if (! $this->hasHeader($header)) { |
|
145 | + if (!$this->hasHeader($header)) { |
|
146 | 146 | return []; |
147 | 147 | } |
148 | 148 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function withAddedHeader($header, $value) : MessageInterface |
234 | 234 | { |
235 | - if (! $this->hasHeader($header)) { |
|
235 | + if (!$this->hasHeader($header)) { |
|
236 | 236 | return $this->withHeader($header, $value); |
237 | 237 | } |
238 | 238 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function withoutHeader($header) : MessageInterface |
260 | 260 | { |
261 | - if (! $this->hasHeader($header)) { |
|
261 | + if (!$this->hasHeader($header)) { |
|
262 | 262 | return clone $this; |
263 | 263 | } |
264 | 264 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | return $stream; |
307 | 307 | } |
308 | 308 | |
309 | - if (! is_string($stream) && ! is_resource($stream)) { |
|
309 | + if (!is_string($stream) && !is_resource($stream)) { |
|
310 | 310 | throw new Exception\InvalidArgumentException( |
311 | 311 | 'Stream must be a string stream resource identifier, ' |
312 | 312 | . 'an actual stream resource, ' |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | 'HTTP protocol version can not be empty' |
353 | 353 | ); |
354 | 354 | } |
355 | - if (! is_string($version)) { |
|
355 | + if (!is_string($version)) { |
|
356 | 356 | throw new Exception\InvalidArgumentException(sprintf( |
357 | 357 | 'Unsupported HTTP protocol version; must be a string, received %s', |
358 | 358 | (is_object($version) ? get_class($version) : gettype($version)) |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | |
362 | 362 | // HTTP/1 uses a "<major>.<minor>" numbering scheme to indicate |
363 | 363 | // versions of the protocol, while HTTP/2 does not. |
364 | - if (! preg_match('#^(1\.[01]|2)$#', $version)) { |
|
364 | + if (!preg_match('#^(1\.[01]|2)$#', $version)) { |
|
365 | 365 | throw new Exception\InvalidArgumentException(sprintf( |
366 | 366 | 'Unsupported HTTP protocol version "%s" provided', |
367 | 367 | $version |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | */ |
376 | 376 | private function filterHeaderValue($values) : array |
377 | 377 | { |
378 | - if (! is_array($values)) { |
|
378 | + if (!is_array($values)) { |
|
379 | 379 | $values = [$values]; |
380 | 380 | } |
381 | 381 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | ); |
387 | 387 | } |
388 | 388 | |
389 | - return array_map(function ($value) { |
|
389 | + return array_map(function($value) { |
|
390 | 390 | return (string) $value; |
391 | 391 | }, array_values($values)); |
392 | 392 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | private function setStatusCode($code, $reasonPhrase = '') : void |
181 | 181 | { |
182 | - if (! is_numeric($code) |
|
182 | + if (!is_numeric($code) |
|
183 | 183 | || is_float($code) |
184 | 184 | || $code < static::MIN_STATUS_CODE_VALUE |
185 | 185 | || $code > static::MAX_STATUS_CODE_VALUE |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | )); |
193 | 193 | } |
194 | 194 | |
195 | - if (! is_string($reasonPhrase)) { |
|
195 | + if (!is_string($reasonPhrase)) { |
|
196 | 196 | throw new Exception\InvalidArgumentException(sprintf( |
197 | 197 | 'Unsupported response reason phrase; must be a string, received %s', |
198 | 198 | is_object($reasonPhrase) ? get_class($reasonPhrase) : gettype($reasonPhrase) |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | // per PSR-7: attempt to set the Host header from a provided URI if no |
95 | 95 | // Host header is provided |
96 | - if (! $this->hasHeader('Host') && $this->uri->getHost()) { |
|
96 | + if (!$this->hasHeader('Host') && $this->uri->getHost()) { |
|
97 | 97 | $this->headerNames['host'] = 'Host'; |
98 | 98 | $this->headers['Host'] = [$this->getHostFromUri()]; |
99 | 99 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | return $new; |
271 | 271 | } |
272 | 272 | |
273 | - if (! $uri->getHost()) { |
|
273 | + if (!$uri->getHost()) { |
|
274 | 274 | return $new; |
275 | 275 | } |
276 | 276 | |
@@ -303,14 +303,14 @@ discard block |
||
303 | 303 | */ |
304 | 304 | private function setMethod($method) : void |
305 | 305 | { |
306 | - if (! is_string($method)) { |
|
306 | + if (!is_string($method)) { |
|
307 | 307 | throw new Exception\InvalidArgumentException(sprintf( |
308 | 308 | 'Unsupported HTTP method; must be a string, received %s', |
309 | 309 | is_object($method) ? get_class($method) : gettype($method) |
310 | 310 | )); |
311 | 311 | } |
312 | 312 | |
313 | - if (! preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)) { |
|
313 | + if (!preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)) { |
|
314 | 314 | throw new Exception\InvalidArgumentException(sprintf( |
315 | 315 | 'Unsupported HTTP method "%s" provided', |
316 | 316 | $method |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | public function getHeaders() : array |
336 | 336 | { |
337 | 337 | $headers = $this->headers; |
338 | - if (! $this->hasHeader('host') |
|
338 | + if (!$this->hasHeader('host') |
|
339 | 339 | && $this->uri->getHost() |
340 | 340 | ) { |
341 | 341 | $headers['Host'] = [$this->getHostFromUri()]; |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | */ |
350 | 350 | public function getHeader($header) : array |
351 | 351 | { |
352 | - if (! $this->hasHeader($header)) { |
|
352 | + if (!$this->hasHeader($header)) { |
|
353 | 353 | if (strtolower($header) === 'host' |
354 | 354 | && $this->uri->getHost() |
355 | 355 | ) { |