@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | protected function validateStatusCode($statusCode) : void |
| 90 | 90 | { |
| 91 | - if (! \is_int($statusCode)) { |
|
| 91 | + if (!\is_int($statusCode)) { |
|
| 92 | 92 | throw new \InvalidArgumentException('HTTP status-code must be an integer'); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - if (! ($statusCode >= 100 && $statusCode <= 599)) { |
|
| 95 | + if (!($statusCode >= 100 && $statusCode <= 599)) { |
|
| 96 | 96 | throw new \InvalidArgumentException(\sprintf('The given status-code "%d" is not valid', $statusCode)); |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | protected function validateReasonPhrase($reasonPhrase) : void |
| 112 | 112 | { |
| 113 | - if (! \is_string($reasonPhrase)) { |
|
| 113 | + if (!\is_string($reasonPhrase)) { |
|
| 114 | 114 | throw new \InvalidArgumentException('HTTP reason-phrase must be a string'); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if (! \preg_match(HeaderInterface::RFC7230_FIELD_VALUE, $reasonPhrase)) { |
|
| 117 | + if (!\preg_match(HeaderInterface::RFC7230_FIELD_VALUE, $reasonPhrase)) { |
|
| 118 | 118 | throw new \InvalidArgumentException(\sprintf('The given reason-phrase "%s" is not valid', $reasonPhrase)); |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -74,11 +74,11 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function getRequestTarget() : string |
| 76 | 76 | { |
| 77 | - if (! (null === $this->requestTarget)) { |
|
| 77 | + if (!(null === $this->requestTarget)) { |
|
| 78 | 78 | return $this->requestTarget; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if (! ($this->uri instanceof UriInterface)) { |
|
| 81 | + if (!($this->uri instanceof UriInterface)) { |
|
| 82 | 82 | return '/'; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -87,12 +87,12 @@ discard block |
||
| 87 | 87 | // |
| 88 | 88 | // origin-form = absolute-path [ "?" query ] |
| 89 | 89 | // absolute-path = 1*( "/" segment ) |
| 90 | - if (! (0 === \strncmp($this->uri->getPath(), '/', 1))) { |
|
| 90 | + if (!(0 === \strncmp($this->uri->getPath(), '/', 1))) { |
|
| 91 | 91 | return '/'; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | $origin = $this->uri->getPath(); |
| 95 | - if (! ('' === $this->uri->getQuery())) { |
|
| 95 | + if (!('' === $this->uri->getQuery())) { |
|
| 96 | 96 | $origin .= '?' . $this->uri->getQuery(); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $newhost = $uri->getHost(); |
| 136 | - if (! (null === $uri->getPort())) { |
|
| 136 | + if (!(null === $uri->getPort())) { |
|
| 137 | 137 | $newhost .= ':' . $uri->getPort(); |
| 138 | 138 | } |
| 139 | 139 | |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | protected function validateMethod($method) : void |
| 156 | 156 | { |
| 157 | - if (! \is_string($method)) { |
|
| 157 | + if (!\is_string($method)) { |
|
| 158 | 158 | throw new \InvalidArgumentException('HTTP method must be a string'); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - if (! \preg_match(HeaderInterface::RFC7230_TOKEN, $method)) { |
|
| 161 | + if (!\preg_match(HeaderInterface::RFC7230_TOKEN, $method)) { |
|
| 162 | 162 | throw new \InvalidArgumentException(\sprintf('The given method "%s" is not valid', $method)); |
| 163 | 163 | } |
| 164 | 164 | } |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | protected function validateRequestTarget($requestTarget) : void |
| 178 | 178 | { |
| 179 | - if (! \is_string($requestTarget)) { |
|
| 179 | + if (!\is_string($requestTarget)) { |
|
| 180 | 180 | throw new \InvalidArgumentException('HTTP request-target must be a string'); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if (! \preg_match('/^[\x21-\x7E\x80-\xFF]+$/', $requestTarget)) { |
|
| 183 | + if (!\preg_match('/^[\x21-\x7E\x80-\xFF]+$/', $requestTarget)) { |
|
| 184 | 184 | throw new \InvalidArgumentException(\sprintf('The given request-target "%s" is not valid', $requestTarget)); |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | $name = $this->normalizeHeaderName($name); |
| 87 | 87 | |
| 88 | - return ! empty($this->headers[$name]); |
|
| 88 | + return !empty($this->headers[$name]); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -262,11 +262,11 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | protected function validateProtocolVersion($protocolVersion) : void |
| 264 | 264 | { |
| 265 | - if (! \is_string($protocolVersion)) { |
|
| 265 | + if (!\is_string($protocolVersion)) { |
|
| 266 | 266 | throw new \InvalidArgumentException('HTTP protocol version must be a string'); |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - if (! \preg_match('/^\d(?:\.\d)?$/', $protocolVersion)) { |
|
| 269 | + if (!\preg_match('/^\d(?:\.\d)?$/', $protocolVersion)) { |
|
| 270 | 270 | throw new \InvalidArgumentException( |
| 271 | 271 | \sprintf('The given protocol version "%s" is not valid', $protocolVersion) |
| 272 | 272 | ); |
@@ -286,11 +286,11 @@ discard block |
||
| 286 | 286 | */ |
| 287 | 287 | protected function validateHeaderName($headerName) : void |
| 288 | 288 | { |
| 289 | - if (! \is_string($headerName)) { |
|
| 289 | + if (!\is_string($headerName)) { |
|
| 290 | 290 | throw new \InvalidArgumentException('Header name must be a string'); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - if (! \preg_match(HeaderInterface::RFC7230_TOKEN, $headerName)) { |
|
| 293 | + if (!\preg_match(HeaderInterface::RFC7230_TOKEN, $headerName)) { |
|
| 294 | 294 | throw new \InvalidArgumentException( |
| 295 | 295 | \sprintf('The given header name "%s" is not valid', $headerName) |
| 296 | 296 | ); |
@@ -314,20 +314,20 @@ discard block |
||
| 314 | 314 | $headerValue = [$headerValue]; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - if (! \is_array($headerValue) || [] === $headerValue) { |
|
| 317 | + if (!\is_array($headerValue) || [] === $headerValue) { |
|
| 318 | 318 | throw new \InvalidArgumentException( |
| 319 | 319 | 'Header value must be a string or not an empty array' |
| 320 | 320 | ); |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | foreach ($headerValue as $oneOf) { |
| 324 | - if (! \is_string($oneOf)) { |
|
| 324 | + if (!\is_string($oneOf)) { |
|
| 325 | 325 | throw new \InvalidArgumentException( |
| 326 | 326 | 'Header value must be a string or an array containing only strings' |
| 327 | 327 | ); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - if (! \preg_match(HeaderInterface::RFC7230_FIELD_VALUE, $oneOf)) { |
|
| 330 | + if (!\preg_match(HeaderInterface::RFC7230_FIELD_VALUE, $oneOf)) { |
|
| 331 | 331 | throw new \InvalidArgumentException( |
| 332 | 332 | \sprintf('The given header value "%s" is not valid', $oneOf) |
| 333 | 333 | ); |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public function createRequest(string $method, $uri) : RequestInterface |
| 35 | 35 | { |
| 36 | - if (! ($uri instanceof UriInterface)) { |
|
| 36 | + if (!($uri instanceof UriInterface)) { |
|
| 37 | 37 | $uri = (new UriFactory)->createUri($uri); |
| 38 | 38 | } |
| 39 | 39 | |