@@ -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); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | $name = $this->normalizeHeaderName($name); |
| 86 | 86 | |
| 87 | - return ! empty($this->headers[$name]); |
|
| 87 | + return !empty($this->headers[$name]); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $name = $this->normalizeHeaderName($name); |
| 147 | 147 | $value = $this->normalizeHeaderValue($value); |
| 148 | 148 | |
| 149 | - if (! empty($this->headers[$name])) |
|
| 149 | + if (!empty($this->headers[$name])) |
|
| 150 | 150 | { |
| 151 | 151 | $value = \array_merge($this->headers[$name], $value); |
| 152 | 152 | } |
@@ -206,11 +206,11 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | protected function validateProtocolVersion($protocolVersion) : void |
| 208 | 208 | { |
| 209 | - if (! \is_string($protocolVersion)) |
|
| 209 | + if (!\is_string($protocolVersion)) |
|
| 210 | 210 | { |
| 211 | 211 | throw new \InvalidArgumentException('HTTP protocol version must be a string'); |
| 212 | 212 | } |
| 213 | - else if (! \preg_match('/^\d(?:\.\d)?$/', $protocolVersion)) |
|
| 213 | + else if (!\preg_match('/^\d(?:\.\d)?$/', $protocolVersion)) |
|
| 214 | 214 | { |
| 215 | 215 | throw new \InvalidArgumentException(\sprintf('The given protocol version "%s" is not valid', $protocolVersion)); |
| 216 | 216 | } |
@@ -229,11 +229,11 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | protected function validateHeaderName($headerName) : void |
| 231 | 231 | { |
| 232 | - if (! \is_string($headerName)) |
|
| 232 | + if (!\is_string($headerName)) |
|
| 233 | 233 | { |
| 234 | 234 | throw new \InvalidArgumentException('Header name must be a string'); |
| 235 | 235 | } |
| 236 | - else if (! \preg_match(RFC7230_TOKEN, $headerName)) |
|
| 236 | + else if (!\preg_match(RFC7230_TOKEN, $headerName)) |
|
| 237 | 237 | { |
| 238 | 238 | throw new \InvalidArgumentException(\sprintf('The given header name "%s" is not valid', $headerName)); |
| 239 | 239 | } |
@@ -257,18 +257,18 @@ discard block |
||
| 257 | 257 | $headerValue = [$headerValue]; |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - if (! \is_array($headerValue) || [] === $headerValue) |
|
| 260 | + if (!\is_array($headerValue) || [] === $headerValue) |
|
| 261 | 261 | { |
| 262 | 262 | throw new \InvalidArgumentException('Header value must be a string or not an empty array'); |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | foreach ($headerValue as $oneOf) |
| 266 | 266 | { |
| 267 | - if (! \is_string($oneOf)) |
|
| 267 | + if (!\is_string($oneOf)) |
|
| 268 | 268 | { |
| 269 | 269 | throw new \InvalidArgumentException('Header value must be a string or an array containing only strings'); |
| 270 | 270 | } |
| 271 | - else if (! \preg_match(RFC7230_FIELD_VALUE, $oneOf)) |
|
| 271 | + else if (!\preg_match(RFC7230_FIELD_VALUE, $oneOf)) |
|
| 272 | 272 | { |
| 273 | 273 | throw new \InvalidArgumentException(\sprintf('The given header value "%s" is not valid', $oneOf)); |
| 274 | 274 | } |
@@ -209,8 +209,7 @@ discard block |
||
| 209 | 209 | if (! \is_string($protocolVersion)) |
| 210 | 210 | { |
| 211 | 211 | throw new \InvalidArgumentException('HTTP protocol version must be a string'); |
| 212 | - } |
|
| 213 | - else if (! \preg_match('/^\d(?:\.\d)?$/', $protocolVersion)) |
|
| 212 | + } else if (! \preg_match('/^\d(?:\.\d)?$/', $protocolVersion)) |
|
| 214 | 213 | { |
| 215 | 214 | throw new \InvalidArgumentException(\sprintf('The given protocol version "%s" is not valid', $protocolVersion)); |
| 216 | 215 | } |
@@ -232,8 +231,7 @@ discard block |
||
| 232 | 231 | if (! \is_string($headerName)) |
| 233 | 232 | { |
| 234 | 233 | throw new \InvalidArgumentException('Header name must be a string'); |
| 235 | - } |
|
| 236 | - else if (! \preg_match(RFC7230_TOKEN, $headerName)) |
|
| 234 | + } else if (! \preg_match(RFC7230_TOKEN, $headerName)) |
|
| 237 | 235 | { |
| 238 | 236 | throw new \InvalidArgumentException(\sprintf('The given header name "%s" is not valid', $headerName)); |
| 239 | 237 | } |
@@ -267,8 +265,7 @@ discard block |
||
| 267 | 265 | if (! \is_string($oneOf)) |
| 268 | 266 | { |
| 269 | 267 | throw new \InvalidArgumentException('Header value must be a string or an array containing only strings'); |
| 270 | - } |
|
| 271 | - else if (! \preg_match(RFC7230_FIELD_VALUE, $oneOf)) |
|
| 268 | + } else if (! \preg_match(RFC7230_FIELD_VALUE, $oneOf)) |
|
| 272 | 269 | { |
| 273 | 270 | throw new \InvalidArgumentException(\sprintf('The given header value "%s" is not valid', $oneOf)); |
| 274 | 271 | } |
@@ -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(RFC7230_TOKEN, $method)) |
|
| 171 | + else if (!\preg_match(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 | } |
@@ -167,8 +167,7 @@ discard block |
||
| 167 | 167 | if (! \is_string($method)) |
| 168 | 168 | { |
| 169 | 169 | throw new \InvalidArgumentException('HTTP method must be a string'); |
| 170 | - } |
|
| 171 | - else if (! \preg_match(RFC7230_TOKEN, $method)) |
|
| 170 | + } else if (! \preg_match(RFC7230_TOKEN, $method)) |
|
| 172 | 171 | { |
| 173 | 172 | throw new \InvalidArgumentException(\sprintf('The given method "%s" is not valid', $method)); |
| 174 | 173 | } |
@@ -190,8 +189,7 @@ discard block |
||
| 190 | 189 | if (! \is_string($requestTarget)) |
| 191 | 190 | { |
| 192 | 191 | throw new \InvalidArgumentException('HTTP request-target must be a string'); |
| 193 | - } |
|
| 194 | - else if (! \preg_match('/^[\x21-\x7E\x80-\xFF]+$/', $requestTarget)) |
|
| 192 | + } else if (! \preg_match('/^[\x21-\x7E\x80-\xFF]+$/', $requestTarget)) |
|
| 195 | 193 | { |
| 196 | 194 | throw new \InvalidArgumentException(\sprintf('The given request-target "%s" is not valid', $requestTarget)); |
| 197 | 195 | } |
@@ -87,11 +87,11 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function validateStatusCode($statusCode) : void |
| 89 | 89 | { |
| 90 | - if (! \is_int($statusCode)) |
|
| 90 | + if (!\is_int($statusCode)) |
|
| 91 | 91 | { |
| 92 | 92 | throw new \InvalidArgumentException('HTTP status-code must be an integer'); |
| 93 | 93 | } |
| 94 | - else if (! ($statusCode >= 100 && $statusCode <= 599)) |
|
| 94 | + else if (!($statusCode >= 100 && $statusCode <= 599)) |
|
| 95 | 95 | { |
| 96 | 96 | throw new \InvalidArgumentException(\sprintf('The given status-code "%d" is not valid', $statusCode)); |
| 97 | 97 | } |
@@ -108,11 +108,11 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function validateReasonPhrase($reasonPhrase) : void |
| 110 | 110 | { |
| 111 | - if (! \is_string($reasonPhrase)) |
|
| 111 | + if (!\is_string($reasonPhrase)) |
|
| 112 | 112 | { |
| 113 | 113 | throw new \InvalidArgumentException('HTTP reason-phrase must be a string'); |
| 114 | 114 | } |
| 115 | - else if (! \preg_match(RFC7230_FIELD_VALUE, $reasonPhrase)) |
|
| 115 | + else if (!\preg_match(RFC7230_FIELD_VALUE, $reasonPhrase)) |
|
| 116 | 116 | { |
| 117 | 117 | throw new \InvalidArgumentException(\sprintf('The given reason-phrase "%s" is not valid', $reasonPhrase)); |
| 118 | 118 | } |
@@ -90,8 +90,7 @@ discard block |
||
| 90 | 90 | if (! \is_int($statusCode)) |
| 91 | 91 | { |
| 92 | 92 | throw new \InvalidArgumentException('HTTP status-code must be an integer'); |
| 93 | - } |
|
| 94 | - else if (! ($statusCode >= 100 && $statusCode <= 599)) |
|
| 93 | + } else if (! ($statusCode >= 100 && $statusCode <= 599)) |
|
| 95 | 94 | { |
| 96 | 95 | throw new \InvalidArgumentException(\sprintf('The given status-code "%d" is not valid', $statusCode)); |
| 97 | 96 | } |
@@ -111,8 +110,7 @@ discard block |
||
| 111 | 110 | if (! \is_string($reasonPhrase)) |
| 112 | 111 | { |
| 113 | 112 | throw new \InvalidArgumentException('HTTP reason-phrase must be a string'); |
| 114 | - } |
|
| 115 | - else if (! \preg_match(RFC7230_FIELD_VALUE, $reasonPhrase)) |
|
| 113 | + } else if (! \preg_match(RFC7230_FIELD_VALUE, $reasonPhrase)) |
|
| 116 | 114 | { |
| 117 | 115 | throw new \InvalidArgumentException(\sprintf('The given reason-phrase "%s" is not valid', $reasonPhrase)); |
| 118 | 116 | } |