@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | */ |
145 | 145 | public function getHeader($header) : array |
146 | 146 | { |
147 | - if (! $this->hasHeader($header)) { |
|
147 | + if (!$this->hasHeader($header)) { |
|
148 | 148 | return []; |
149 | 149 | } |
150 | 150 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | { |
239 | 239 | $this->assertHeader($header); |
240 | 240 | |
241 | - if (! $this->hasHeader($header)) { |
|
241 | + if (!$this->hasHeader($header)) { |
|
242 | 242 | return $this->withHeader($header, $value); |
243 | 243 | } |
244 | 244 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | */ |
265 | 265 | public function withoutHeader($header) : MessageInterface |
266 | 266 | { |
267 | - if (! $this->hasHeader($header)) { |
|
267 | + if (!$this->hasHeader($header)) { |
|
268 | 268 | return clone $this; |
269 | 269 | } |
270 | 270 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | return $stream; |
313 | 313 | } |
314 | 314 | |
315 | - if (! is_string($stream) && ! is_resource($stream)) { |
|
315 | + if (!is_string($stream) && !is_resource($stream)) { |
|
316 | 316 | throw new Exception\InvalidArgumentException( |
317 | 317 | 'Stream must be a string stream resource identifier, ' |
318 | 318 | . 'an actual stream resource, ' |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | 'HTTP protocol version can not be empty' |
361 | 361 | ); |
362 | 362 | } |
363 | - if (! is_string($version)) { |
|
363 | + if (!is_string($version)) { |
|
364 | 364 | throw new Exception\InvalidArgumentException(sprintf( |
365 | 365 | 'Unsupported HTTP protocol version; must be a string, received %s', |
366 | 366 | (is_object($version) ? get_class($version) : gettype($version)) |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | |
370 | 370 | // HTTP/1 uses a "<major>.<minor>" numbering scheme to indicate |
371 | 371 | // versions of the protocol, while HTTP/2 does not. |
372 | - if (! preg_match('#^(1\.[01]|2)$#', $version)) { |
|
372 | + if (!preg_match('#^(1\.[01]|2)$#', $version)) { |
|
373 | 373 | throw new Exception\InvalidArgumentException(sprintf( |
374 | 374 | 'Unsupported HTTP protocol version "%s" provided', |
375 | 375 | $version |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | */ |
384 | 384 | private function filterHeaderValue($values) : array |
385 | 385 | { |
386 | - if (! is_array($values)) { |
|
386 | + if (!is_array($values)) { |
|
387 | 387 | $values = [$values]; |
388 | 388 | } |
389 | 389 | |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | ); |
395 | 395 | } |
396 | 396 | |
397 | - return array_map(function ($value) { |
|
397 | + return array_map(function($value) { |
|
398 | 398 | HeaderSecurity::assertValid($value); |
399 | 399 | |
400 | 400 | return (string) $value; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function withParsedBody($data) : ServerRequest |
183 | 183 | { |
184 | - if (! is_array($data) && ! is_object($data) && null !== $data) { |
|
184 | + if (!is_array($data) && !is_object($data) && null !== $data) { |
|
185 | 185 | throw new Exception\InvalidArgumentException(sprintf( |
186 | 186 | '%s expects a null, array, or object argument; received %s', |
187 | 187 | __METHOD__, |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function getAttribute($attribute, $default = null) |
209 | 209 | { |
210 | - if (! array_key_exists($attribute, $this->attributes)) { |
|
210 | + if (!array_key_exists($attribute, $this->attributes)) { |
|
211 | 211 | return $default; |
212 | 212 | } |
213 | 213 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | continue; |
248 | 248 | } |
249 | 249 | |
250 | - if (! $file instanceof UploadedFileInterface) { |
|
250 | + if (!$file instanceof UploadedFileInterface) { |
|
251 | 251 | throw new Exception\InvalidArgumentException('Invalid leaf in uploaded files structure'); |
252 | 252 | } |
253 | 253 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $line = ''; |
45 | 45 | $crFound = false; |
46 | - while (! $stream->eof()) { |
|
46 | + while (!$stream->eof()) { |
|
47 | 47 | $char = $stream->read(1); |
48 | 48 | |
49 | 49 | if ($crFound && $char === self::LF) { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | // LF in isolation |
60 | - if (! $crFound && $char === self::LF) { |
|
60 | + if (!$crFound && $char === self::LF) { |
|
61 | 61 | throw Exception\DeserializationException::forUnexpectedLineFeed(); |
62 | 62 | } |
63 | 63 | |
@@ -97,24 +97,24 @@ discard block |
||
97 | 97 | while ($line = self::getLine($stream)) { |
98 | 98 | if (preg_match(';^(?P<name>[!#$%&\'*+.^_`\|~0-9a-zA-Z-]+):(?P<value>.*)$;', $line, $matches)) { |
99 | 99 | $currentHeader = $matches['name']; |
100 | - if (! isset($headers[$currentHeader])) { |
|
100 | + if (!isset($headers[$currentHeader])) { |
|
101 | 101 | $headers[$currentHeader] = []; |
102 | 102 | } |
103 | 103 | $headers[$currentHeader][] = ltrim($matches['value']); |
104 | 104 | continue; |
105 | 105 | } |
106 | 106 | |
107 | - if (! $currentHeader) { |
|
107 | + if (!$currentHeader) { |
|
108 | 108 | throw Exception\DeserializationException::forInvalidHeader(); |
109 | 109 | } |
110 | 110 | |
111 | - if (! preg_match('#^[ \t]#', $line)) { |
|
111 | + if (!preg_match('#^[ \t]#', $line)) { |
|
112 | 112 | throw Exception\DeserializationException::forInvalidHeaderContinuation(); |
113 | 113 | } |
114 | 114 | |
115 | 115 | // Append continuation to last header value found |
116 | 116 | $value = array_pop($headers[$currentHeader]); |
117 | - $headers[$currentHeader][] = $value . ltrim($line); |
|
117 | + $headers[$currentHeader][] = $value.ltrim($line); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | // use RelativeStream to avoid copying initial stream into memory |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | $this->stream = new Stream($streamOrFile); |
108 | 108 | } |
109 | 109 | |
110 | - if (! $this->file && ! $this->stream) { |
|
111 | - if (! $streamOrFile instanceof StreamInterface) { |
|
110 | + if (!$this->file && !$this->stream) { |
|
111 | + if (!$streamOrFile instanceof StreamInterface) { |
|
112 | 112 | throw new Exception\InvalidArgumentException('Invalid stream or file provided for UploadedFile'); |
113 | 113 | } |
114 | 114 | $this->stream = $streamOrFile; |
@@ -176,20 +176,20 @@ discard block |
||
176 | 176 | ); |
177 | 177 | } |
178 | 178 | |
179 | - if (! is_string($targetPath) || empty($targetPath)) { |
|
179 | + if (!is_string($targetPath) || empty($targetPath)) { |
|
180 | 180 | throw new Exception\InvalidArgumentException( |
181 | 181 | 'Invalid path provided for move operation; must be a non-empty string' |
182 | 182 | ); |
183 | 183 | } |
184 | 184 | |
185 | 185 | $targetDirectory = dirname($targetPath); |
186 | - if (! is_dir($targetDirectory) || ! is_writable($targetDirectory)) { |
|
186 | + if (!is_dir($targetDirectory) || !is_writable($targetDirectory)) { |
|
187 | 187 | throw Exception\UploadedFileErrorException::dueToUnwritableTarget($targetDirectory); |
188 | 188 | } |
189 | 189 | |
190 | 190 | $sapi = PHP_SAPI; |
191 | 191 | switch (true) { |
192 | - case (empty($sapi) || 0 === strpos($sapi, 'cli') || ! $this->file): |
|
192 | + case (empty($sapi) || 0 === strpos($sapi, 'cli') || !$this->file): |
|
193 | 193 | // Non-SAPI environment, or no filename present |
194 | 194 | $this->writeFile($targetPath); |
195 | 195 | break; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | $stream = $this->getStream(); |
260 | 260 | $stream->rewind(); |
261 | - while (! $stream->eof()) { |
|
261 | + while (!$stream->eof()) { |
|
262 | 262 | fwrite($handle, $stream->read(4096)); |
263 | 263 | } |
264 | 264 |
@@ -173,7 +173,7 @@ |
||
173 | 173 | return $metadata; |
174 | 174 | } |
175 | 175 | |
176 | - if (! array_key_exists($key, $metadata)) { |
|
176 | + if (!array_key_exists($key, $metadata)) { |
|
177 | 177 | return null; |
178 | 178 | } |
179 | 179 |
@@ -63,7 +63,7 @@ |
||
63 | 63 | return $html; |
64 | 64 | } |
65 | 65 | |
66 | - if (! is_string($html)) { |
|
66 | + if (!is_string($html)) { |
|
67 | 67 | throw new Exception\InvalidArgumentException(sprintf( |
68 | 68 | 'Invalid content (%s) provided to %s', |
69 | 69 | (is_object($html) ? get_class($html) : gettype($html)), |
@@ -65,7 +65,7 @@ |
||
65 | 65 | return $xml; |
66 | 66 | } |
67 | 67 | |
68 | - if (! is_string($xml)) { |
|
68 | + if (!is_string($xml)) { |
|
69 | 69 | throw new Exception\InvalidArgumentException(sprintf( |
70 | 70 | 'Invalid content (%s) provided to %s', |
71 | 71 | (is_object($xml) ? get_class($xml) : gettype($xml)), |
@@ -38,7 +38,7 @@ |
||
38 | 38 | */ |
39 | 39 | public function __construct($uri, int $status = 302, array $headers = []) |
40 | 40 | { |
41 | - if (! is_string($uri) && ! $uri instanceof UriInterface) { |
|
41 | + if (!is_string($uri) && !$uri instanceof UriInterface) { |
|
42 | 42 | throw new Exception\InvalidArgumentException(sprintf( |
43 | 43 | 'Uri provided to %s MUST be a string or Psr\Http\Message\UriInterface instance; received "%s"', |
44 | 44 | __CLASS__, |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public static function fromStream(StreamInterface $stream) : Response |
43 | 43 | { |
44 | - if (! $stream->isReadable() || ! $stream->isSeekable()) { |
|
44 | + if (!$stream->isReadable() || !$stream->isSeekable()) { |
|
45 | 45 | throw new Exception\InvalidArgumentException('Message stream must be both readable and seekable'); |
46 | 46 | } |
47 | 47 | |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | $body = (string) $response->getBody(); |
66 | 66 | $format = 'HTTP/%s %d%s%s%s'; |
67 | 67 | |
68 | - if (! empty($headers)) { |
|
69 | - $headers = "\r\n" . $headers; |
|
68 | + if (!empty($headers)) { |
|
69 | + $headers = "\r\n".$headers; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | $headers .= "\r\n\r\n"; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $format, |
76 | 76 | $response->getProtocolVersion(), |
77 | 77 | $response->getStatusCode(), |
78 | - ($reasonPhrase ? ' ' . $reasonPhrase : ''), |
|
78 | + ($reasonPhrase ? ' '.$reasonPhrase : ''), |
|
79 | 79 | $headers, |
80 | 80 | $body |
81 | 81 | ); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | { |
92 | 92 | $line = self::getLine($stream); |
93 | 93 | |
94 | - if (! preg_match( |
|
94 | + if (!preg_match( |
|
95 | 95 | '#^HTTP/(?P<version>[1-9]\d*\.\d) (?P<status>[1-5]\d{2})(\s+(?P<reason>.+))?$#', |
96 | 96 | $line, |
97 | 97 | $matches |