@@ -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 | { |
| 38 | 38 | $uri = (new UriFactory) |
| 39 | 39 | ->createUri($uri); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | { |
| 99 | 99 | $name = $this->normalizeHeaderName($name); |
| 100 | 100 | |
| 101 | - return ! empty($this->headers[$name]); |
|
| 101 | + return !empty($this->headers[$name]); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $name = $this->normalizeHeaderName($name); |
| 161 | 161 | $value = $this->normalizeHeaderValue($value); |
| 162 | 162 | |
| 163 | - if (! empty($this->headers[$name])) |
|
| 163 | + if (!empty($this->headers[$name])) |
|
| 164 | 164 | { |
| 165 | 165 | $value = \array_merge($this->headers[$name], $value); |
| 166 | 166 | } |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | protected function validateProtocolVersion($protocolVersion) : void |
| 222 | 222 | { |
| 223 | - if (! \is_string($protocolVersion)) |
|
| 223 | + if (!\is_string($protocolVersion)) |
|
| 224 | 224 | { |
| 225 | 225 | throw new \InvalidArgumentException('HTTP protocol version must be a string'); |
| 226 | 226 | } |
| 227 | - else if (! \preg_match('/^\d(?:\.\d)?$/', $protocolVersion)) |
|
| 227 | + else if (!\preg_match('/^\d(?:\.\d)?$/', $protocolVersion)) |
|
| 228 | 228 | { |
| 229 | 229 | throw new \InvalidArgumentException(\sprintf('The given protocol version "%s" is not valid', $protocolVersion)); |
| 230 | 230 | } |
@@ -243,11 +243,11 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | protected function validateHeaderName($headerName) : void |
| 245 | 245 | { |
| 246 | - if (! \is_string($headerName)) |
|
| 246 | + if (!\is_string($headerName)) |
|
| 247 | 247 | { |
| 248 | 248 | throw new \InvalidArgumentException('Header name must be a string'); |
| 249 | 249 | } |
| 250 | - else if (! \preg_match(self::RFC7230_TOKEN, $headerName)) |
|
| 250 | + else if (!\preg_match(self::RFC7230_TOKEN, $headerName)) |
|
| 251 | 251 | { |
| 252 | 252 | throw new \InvalidArgumentException(\sprintf('The given header name "%s" is not valid', $headerName)); |
| 253 | 253 | } |
@@ -271,18 +271,18 @@ discard block |
||
| 271 | 271 | $headerValue = [$headerValue]; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - if (! \is_array($headerValue) || [] === $headerValue) |
|
| 274 | + if (!\is_array($headerValue) || [] === $headerValue) |
|
| 275 | 275 | { |
| 276 | 276 | throw new \InvalidArgumentException('Header value must be a string or not an empty array'); |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | foreach ($headerValue as $oneOf) |
| 280 | 280 | { |
| 281 | - if (! \is_string($oneOf)) |
|
| 281 | + if (!\is_string($oneOf)) |
|
| 282 | 282 | { |
| 283 | 283 | throw new \InvalidArgumentException('Header value must be a string or an array containing only strings'); |
| 284 | 284 | } |
| 285 | - else if (! \preg_match(self::RFC7230_FIELD_VALUE, $oneOf)) |
|
| 285 | + else if (!\preg_match(self::RFC7230_FIELD_VALUE, $oneOf)) |
|
| 286 | 286 | { |
| 287 | 287 | throw new \InvalidArgumentException(\sprintf('The given header value "%s" is not valid', $oneOf)); |
| 288 | 288 | } |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function getRequestTarget() : string |
| 76 | 76 | { |
| 77 | - if (! (null === $this->requestTarget)) |
|
| 77 | + if (!(null === $this->requestTarget)) |
|
| 78 | 78 | { |
| 79 | 79 | return $this->requestTarget; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if (! ($this->uri instanceof UriInterface)) |
|
| 82 | + if (!($this->uri instanceof UriInterface)) |
|
| 83 | 83 | { |
| 84 | 84 | return '/'; |
| 85 | 85 | } |
@@ -89,14 +89,14 @@ discard block |
||
| 89 | 89 | // |
| 90 | 90 | // origin-form = absolute-path [ "?" query ] |
| 91 | 91 | // absolute-path = 1*( "/" segment ) |
| 92 | - if (! (0 === \strncmp($this->uri->getPath(), '/', 1))) |
|
| 92 | + if (!(0 === \strncmp($this->uri->getPath(), '/', 1))) |
|
| 93 | 93 | { |
| 94 | 94 | return '/'; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | $origin = $this->uri->getPath(); |
| 98 | 98 | |
| 99 | - if (! ('' === $this->uri->getQuery())) |
|
| 99 | + if (!('' === $this->uri->getQuery())) |
|
| 100 | 100 | { |
| 101 | 101 | $origin .= '?' . $this->uri->getQuery(); |
| 102 | 102 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | $newhost = $uri->getHost(); |
| 144 | 144 | |
| 145 | - if (! (null === $uri->getPort())) |
|
| 145 | + if (!(null === $uri->getPort())) |
|
| 146 | 146 | { |
| 147 | 147 | $newhost .= ':' . $uri->getPort(); |
| 148 | 148 | } |
@@ -164,11 +164,11 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | protected function validateMethod($method) : void |
| 166 | 166 | { |
| 167 | - if (! \is_string($method)) |
|
| 167 | + if (!\is_string($method)) |
|
| 168 | 168 | { |
| 169 | 169 | throw new \InvalidArgumentException('HTTP method must be a string'); |
| 170 | 170 | } |
| 171 | - else if (! \preg_match(self::RFC7230_TOKEN, $method)) |
|
| 171 | + else if (!\preg_match(self::RFC7230_TOKEN, $method)) |
|
| 172 | 172 | { |
| 173 | 173 | throw new \InvalidArgumentException(\sprintf('The given method "%s" is not valid', $method)); |
| 174 | 174 | } |
@@ -187,11 +187,11 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | protected function validateRequestTarget($requestTarget) : void |
| 189 | 189 | { |
| 190 | - if (! \is_string($requestTarget)) |
|
| 190 | + if (!\is_string($requestTarget)) |
|
| 191 | 191 | { |
| 192 | 192 | throw new \InvalidArgumentException('HTTP request-target must be a string'); |
| 193 | 193 | } |
| 194 | - else if (! \preg_match('/^[\x21-\x7E\x80-\xFF]+$/', $requestTarget)) |
|
| 194 | + else if (!\preg_match('/^[\x21-\x7E\x80-\xFF]+$/', $requestTarget)) |
|
| 195 | 195 | { |
| 196 | 196 | throw new \InvalidArgumentException(\sprintf('The given request-target "%s" is not valid', $requestTarget)); |
| 197 | 197 | } |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | protected function validateStatusCode($statusCode) : void |
| 91 | 91 | { |
| 92 | - if (! \is_int($statusCode)) |
|
| 92 | + if (!\is_int($statusCode)) |
|
| 93 | 93 | { |
| 94 | 94 | throw new \InvalidArgumentException('HTTP status-code must be an integer'); |
| 95 | 95 | } |
| 96 | - else if (! ($statusCode >= 100 && $statusCode <= 599)) |
|
| 96 | + else if (!($statusCode >= 100 && $statusCode <= 599)) |
|
| 97 | 97 | { |
| 98 | 98 | throw new \InvalidArgumentException(\sprintf('The given status-code "%d" is not valid', $statusCode)); |
| 99 | 99 | } |
@@ -112,11 +112,11 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | protected function validateReasonPhrase($reasonPhrase) : void |
| 114 | 114 | { |
| 115 | - if (! \is_string($reasonPhrase)) |
|
| 115 | + if (!\is_string($reasonPhrase)) |
|
| 116 | 116 | { |
| 117 | 117 | throw new \InvalidArgumentException('HTTP reason-phrase must be a string'); |
| 118 | 118 | } |
| 119 | - else if (! \preg_match(self::RFC7230_FIELD_VALUE, $reasonPhrase)) |
|
| 119 | + else if (!\preg_match(self::RFC7230_FIELD_VALUE, $reasonPhrase)) |
|
| 120 | 120 | { |
| 121 | 121 | throw new \InvalidArgumentException(\sprintf('The given reason-phrase "%s" is not valid', $reasonPhrase)); |
| 122 | 122 | } |