@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | */ |
91 | 91 | protected function validateStatusCode($statusCode) : void |
92 | 92 | { |
93 | - if (! \is_int($statusCode)) |
|
93 | + if (!\is_int($statusCode)) |
|
94 | 94 | { |
95 | 95 | throw new \InvalidArgumentException('HTTP status-code must be an integer'); |
96 | 96 | } |
97 | - else if (! ($statusCode >= 100 && $statusCode <= 599)) |
|
97 | + else if (!($statusCode >= 100 && $statusCode <= 599)) |
|
98 | 98 | { |
99 | 99 | throw new \InvalidArgumentException(\sprintf('The given status-code "%d" is not valid', $statusCode)); |
100 | 100 | } |
@@ -113,11 +113,11 @@ discard block |
||
113 | 113 | */ |
114 | 114 | protected function validateReasonPhrase($reasonPhrase) : void |
115 | 115 | { |
116 | - if (! \is_string($reasonPhrase)) |
|
116 | + if (!\is_string($reasonPhrase)) |
|
117 | 117 | { |
118 | 118 | throw new \InvalidArgumentException('HTTP reason-phrase must be a string'); |
119 | 119 | } |
120 | - else if (! \preg_match(HeaderInterface::RFC7230_FIELD_VALUE, $reasonPhrase)) |
|
120 | + else if (!\preg_match(HeaderInterface::RFC7230_FIELD_VALUE, $reasonPhrase)) |
|
121 | 121 | { |
122 | 122 | throw new \InvalidArgumentException(\sprintf('The given reason-phrase "%s" is not valid', $reasonPhrase)); |
123 | 123 | } |
@@ -93,8 +93,7 @@ discard block |
||
93 | 93 | if (! \is_int($statusCode)) |
94 | 94 | { |
95 | 95 | throw new \InvalidArgumentException('HTTP status-code must be an integer'); |
96 | - } |
|
97 | - else if (! ($statusCode >= 100 && $statusCode <= 599)) |
|
96 | + } else if (! ($statusCode >= 100 && $statusCode <= 599)) |
|
98 | 97 | { |
99 | 98 | throw new \InvalidArgumentException(\sprintf('The given status-code "%d" is not valid', $statusCode)); |
100 | 99 | } |
@@ -116,8 +115,7 @@ discard block |
||
116 | 115 | if (! \is_string($reasonPhrase)) |
117 | 116 | { |
118 | 117 | throw new \InvalidArgumentException('HTTP reason-phrase must be a string'); |
119 | - } |
|
120 | - else if (! \preg_match(HeaderInterface::RFC7230_FIELD_VALUE, $reasonPhrase)) |
|
118 | + } else if (! \preg_match(HeaderInterface::RFC7230_FIELD_VALUE, $reasonPhrase)) |
|
121 | 119 | { |
122 | 120 | throw new \InvalidArgumentException(\sprintf('The given reason-phrase "%s" is not valid', $reasonPhrase)); |
123 | 121 | } |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function getRequestTarget() : string |
77 | 77 | { |
78 | - if (! (null === $this->requestTarget)) |
|
78 | + if (!(null === $this->requestTarget)) |
|
79 | 79 | { |
80 | 80 | return $this->requestTarget; |
81 | 81 | } |
82 | 82 | |
83 | - if (! ($this->uri instanceof UriInterface)) |
|
83 | + if (!($this->uri instanceof UriInterface)) |
|
84 | 84 | { |
85 | 85 | return '/'; |
86 | 86 | } |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | // |
91 | 91 | // origin-form = absolute-path [ "?" query ] |
92 | 92 | // absolute-path = 1*( "/" segment ) |
93 | - if (! (0 === \strncmp($this->uri->getPath(), '/', 1))) |
|
93 | + if (!(0 === \strncmp($this->uri->getPath(), '/', 1))) |
|
94 | 94 | { |
95 | 95 | return '/'; |
96 | 96 | } |
97 | 97 | |
98 | 98 | $origin = $this->uri->getPath(); |
99 | 99 | |
100 | - if (! ('' === $this->uri->getQuery())) |
|
100 | + if (!('' === $this->uri->getQuery())) |
|
101 | 101 | { |
102 | 102 | $origin .= '?' . $this->uri->getQuery(); |
103 | 103 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | $newhost = $uri->getHost(); |
145 | 145 | |
146 | - if (! (null === $uri->getPort())) |
|
146 | + if (!(null === $uri->getPort())) |
|
147 | 147 | { |
148 | 148 | $newhost .= ':' . $uri->getPort(); |
149 | 149 | } |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | */ |
166 | 166 | protected function validateMethod($method) : void |
167 | 167 | { |
168 | - if (! \is_string($method)) |
|
168 | + if (!\is_string($method)) |
|
169 | 169 | { |
170 | 170 | throw new \InvalidArgumentException('HTTP method must be a string'); |
171 | 171 | } |
172 | - else if (! \preg_match(HeaderInterface::RFC7230_TOKEN, $method)) |
|
172 | + else if (!\preg_match(HeaderInterface::RFC7230_TOKEN, $method)) |
|
173 | 173 | { |
174 | 174 | throw new \InvalidArgumentException(\sprintf('The given method "%s" is not valid', $method)); |
175 | 175 | } |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | */ |
189 | 189 | protected function validateRequestTarget($requestTarget) : void |
190 | 190 | { |
191 | - if (! \is_string($requestTarget)) |
|
191 | + if (!\is_string($requestTarget)) |
|
192 | 192 | { |
193 | 193 | throw new \InvalidArgumentException('HTTP request-target must be a string'); |
194 | 194 | } |
195 | - else if (! \preg_match('/^[\x21-\x7E\x80-\xFF]+$/', $requestTarget)) |
|
195 | + else if (!\preg_match('/^[\x21-\x7E\x80-\xFF]+$/', $requestTarget)) |
|
196 | 196 | { |
197 | 197 | throw new \InvalidArgumentException(\sprintf('The given request-target "%s" is not valid', $requestTarget)); |
198 | 198 | } |
@@ -168,8 +168,7 @@ discard block |
||
168 | 168 | if (! \is_string($method)) |
169 | 169 | { |
170 | 170 | throw new \InvalidArgumentException('HTTP method must be a string'); |
171 | - } |
|
172 | - else if (! \preg_match(HeaderInterface::RFC7230_TOKEN, $method)) |
|
171 | + } else if (! \preg_match(HeaderInterface::RFC7230_TOKEN, $method)) |
|
173 | 172 | { |
174 | 173 | throw new \InvalidArgumentException(\sprintf('The given method "%s" is not valid', $method)); |
175 | 174 | } |
@@ -191,8 +190,7 @@ discard block |
||
191 | 190 | if (! \is_string($requestTarget)) |
192 | 191 | { |
193 | 192 | throw new \InvalidArgumentException('HTTP request-target must be a string'); |
194 | - } |
|
195 | - else if (! \preg_match('/^[\x21-\x7E\x80-\xFF]+$/', $requestTarget)) |
|
193 | + } else if (! \preg_match('/^[\x21-\x7E\x80-\xFF]+$/', $requestTarget)) |
|
196 | 194 | { |
197 | 195 | throw new \InvalidArgumentException(\sprintf('The given request-target "%s" is not valid', $requestTarget)); |
198 | 196 | } |
@@ -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 | /** |
@@ -215,11 +215,11 @@ discard block |
||
215 | 215 | */ |
216 | 216 | protected function validateProtocolVersion($protocolVersion) : void |
217 | 217 | { |
218 | - if (! \is_string($protocolVersion)) { |
|
218 | + if (!\is_string($protocolVersion)) { |
|
219 | 219 | throw new \InvalidArgumentException('HTTP protocol version must be a string'); |
220 | 220 | } |
221 | 221 | |
222 | - if (! \preg_match('/^\d(?:\.\d)?$/', $protocolVersion)) { |
|
222 | + if (!\preg_match('/^\d(?:\.\d)?$/', $protocolVersion)) { |
|
223 | 223 | throw new \InvalidArgumentException( |
224 | 224 | \sprintf('The given protocol version "%s" is not valid', $protocolVersion) |
225 | 225 | ); |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | */ |
240 | 240 | protected function validateHeaderName($headerName) : void |
241 | 241 | { |
242 | - if (! \is_string($headerName)) { |
|
242 | + if (!\is_string($headerName)) { |
|
243 | 243 | throw new \InvalidArgumentException('Header name must be a string'); |
244 | 244 | } |
245 | 245 | |
246 | - if (! \preg_match(HeaderInterface::RFC7230_TOKEN, $headerName)) { |
|
246 | + if (!\preg_match(HeaderInterface::RFC7230_TOKEN, $headerName)) { |
|
247 | 247 | throw new \InvalidArgumentException( |
248 | 248 | \sprintf('The given header name "%s" is not valid', $headerName) |
249 | 249 | ); |
@@ -267,16 +267,16 @@ discard block |
||
267 | 267 | $headerValue = [$headerValue]; |
268 | 268 | } |
269 | 269 | |
270 | - if (! \is_array($headerValue) || [] === $headerValue) { |
|
270 | + if (!\is_array($headerValue) || [] === $headerValue) { |
|
271 | 271 | throw new \InvalidArgumentException('Header value must be a string or not an empty array'); |
272 | 272 | } |
273 | 273 | |
274 | 274 | foreach ($headerValue as $oneOf) { |
275 | - if (! \is_string($oneOf)) { |
|
275 | + if (!\is_string($oneOf)) { |
|
276 | 276 | throw new \InvalidArgumentException('Header value must be a string or an array containing only strings'); |
277 | 277 | } |
278 | 278 | |
279 | - if (! \preg_match(HeaderInterface::RFC7230_FIELD_VALUE, $oneOf)) { |
|
279 | + if (!\preg_match(HeaderInterface::RFC7230_FIELD_VALUE, $oneOf)) { |
|
280 | 280 | throw new \InvalidArgumentException( |
281 | 281 | \sprintf('The given header value "%s" is not valid', $oneOf) |
282 | 282 | ); |