@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $target = $target ?: '/'; |
55 | 55 | |
56 | 56 | if ('' !== $this->uri->getQuery()) { |
57 | - $target .= '?' . $this->uri->getQuery(); |
|
57 | + $target .= '?'.$this->uri->getQuery(); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | $this->requestTarget = $target; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | if (null !== ($port = $this->uri->getPort())) { |
112 | - $host .= ':' . $port; |
|
112 | + $host .= ':'.$port; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | $this->headers['host'] = [$host]; |
@@ -175,7 +175,7 @@ |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | if (-1 === fseek($this->stream, $offset, $whence)) { |
178 | - throw new RuntimeException('Unable to seek to stream position ' . $offset . ' with whence ' . \var_export($whence, true)); |
|
178 | + throw new RuntimeException('Unable to seek to stream position '.$offset.' with whence '.\var_export($whence, true)); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 |
@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | public function withBody(StreamInterface $body): Message |
44 | 44 | { |
45 | - $this->data = json_decode((string)$body, true, 512, JSON_THROW_ON_ERROR); |
|
45 | + $this->data = json_decode((string) $body, true, 512, JSON_THROW_ON_ERROR); |
|
46 | 46 | $this->isSyncBody = true; |
47 | 47 | return parent::withBody($body); |
48 | 48 | } |
@@ -57,10 +57,10 @@ |
||
57 | 57 | $resource = @fopen($filename, $mode); |
58 | 58 | if (false === $resource) { |
59 | 59 | if ('' === $mode || false === in_array($mode[0], ['r', 'w', 'a', 'x', 'c'])) { |
60 | - throw new InvalidArgumentException('The mode ' . $mode . ' is invalid.'); |
|
60 | + throw new InvalidArgumentException('The mode '.$mode.' is invalid.'); |
|
61 | 61 | } |
62 | 62 | |
63 | - throw new RuntimeException('The file ' . $filename . ' cannot be opened.'); |
|
63 | + throw new RuntimeException('The file '.$filename.' cannot be opened.'); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | return Stream::create($resource); |
@@ -22,7 +22,7 @@ |
||
22 | 22 | |
23 | 23 | public function createResponse($statusCode = 200, $reasonPhrase = null, array $headers = [], $body = null, $version = '1.1') |
24 | 24 | { |
25 | - return new Response((int)$statusCode, $headers, $body, $version, $reasonPhrase); |
|
25 | + return new Response((int) $statusCode, $headers, $body, $version, $reasonPhrase); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function createStream($body = null) |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $this->query = isset($parts['query']) ? $this->filterQueryAndFragment($parts['query']) : ''; |
44 | 44 | $this->fragment = isset($parts['fragment']) ? $this->filterQueryAndFragment($parts['fragment']) : ''; |
45 | 45 | if (isset($parts['pass'])) { |
46 | - $this->userInfo .= ':' . $parts['pass']; |
|
46 | + $this->userInfo .= ':'.$parts['pass']; |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | } |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | |
67 | 67 | $authority = $this->host; |
68 | 68 | if ('' !== $this->userInfo) { |
69 | - $authority = $this->userInfo . '@' . $authority; |
|
69 | + $authority = $this->userInfo.'@'.$authority; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | if (null !== $this->port) { |
73 | - $authority .= ':' . $this->port; |
|
73 | + $authority .= ':'.$this->port; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | return $authority; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | { |
119 | 119 | $info = $user; |
120 | 120 | if (null !== $password && '' !== $password) { |
121 | - $info .= ':' . $password; |
|
121 | + $info .= ':'.$password; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | $this->userInfo = $info; |
@@ -172,24 +172,24 @@ discard block |
||
172 | 172 | { |
173 | 173 | $uri = ''; |
174 | 174 | if ('' !== $scheme) { |
175 | - $uri .= $scheme . ':'; |
|
175 | + $uri .= $scheme.':'; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | if ('' !== $authority) { |
179 | - $uri .= '//' . $authority; |
|
179 | + $uri .= '//'.$authority; |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | if ('' !== $path) { |
183 | 183 | if ('/' !== $path[0]) { |
184 | 184 | if ('' !== $authority) { |
185 | 185 | // If the path is rootless and an authority is present, the path MUST be prefixed by "/" |
186 | - $path = '/' . $path; |
|
186 | + $path = '/'.$path; |
|
187 | 187 | } |
188 | 188 | } elseif (isset($path[1]) && '/' === $path[1]) { |
189 | 189 | if ('' === $authority) { |
190 | 190 | // If the path is starting with more than one "/" and no authority is present, the |
191 | 191 | // starting slashes MUST be reduced to one. |
192 | - $path = '/' . \ltrim($path, '/'); |
|
192 | + $path = '/'.\ltrim($path, '/'); |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
@@ -197,11 +197,11 @@ discard block |
||
197 | 197 | } |
198 | 198 | |
199 | 199 | if ('' !== $query) { |
200 | - $uri .= '?' . $query; |
|
200 | + $uri .= '?'.$query; |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | if ('' !== $fragment) { |
204 | - $uri .= '#' . $fragment; |
|
204 | + $uri .= '#'.$fragment; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | return $uri; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | throw new InvalidArgumentException('Path must be a string'); |
228 | 228 | } |
229 | 229 | |
230 | - return preg_replace_callback('/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/', [__CLASS__, 'rawurlencodeMatchZero'], $path); |
|
230 | + return preg_replace_callback('/(?:[^'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.'%:@\/]++|%(?![A-Fa-f0-9]{2}))/', [__CLASS__, 'rawurlencodeMatchZero'], $path); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | private function filterQueryAndFragment($str): string |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | throw new InvalidArgumentException('Query and fragment must be a string'); |
237 | 237 | } |
238 | 238 | |
239 | - return preg_replace_callback('/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', [__CLASS__, 'rawurlencodeMatchZero'], $str); |
|
239 | + return preg_replace_callback('/(?:[^'.self::CHAR_UNRESERVED.self::CHAR_SUB_DELIMS.'%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', [__CLASS__, 'rawurlencodeMatchZero'], $str); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | private static function rawUrlEncodeMatchZero(array $match): string |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | public function withHeader($name, $value): self |
64 | 64 | { |
65 | 65 | $name = strtolower($name); |
66 | - $this->headers[$name] = $this->validateAndTrimHeader($name, (array)$value); |
|
66 | + $this->headers[$name] = $this->validateAndTrimHeader($name, (array) $value); |
|
67 | 67 | return $this; |
68 | 68 | } |
69 | 69 | |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | |
109 | 109 | $returnValues = []; |
110 | 110 | foreach ($values as $v) { |
111 | - if ((!is_numeric($v) && !is_string($v)) || 1 !== preg_match("@^[ \t\x21-\x7E\x80-\xFF]*$@", (string)$v)) { |
|
111 | + if ((!is_numeric($v) && !is_string($v)) || 1 !== preg_match("@^[ \t\x21-\x7E\x80-\xFF]*$@", (string) $v)) { |
|
112 | 112 | throw new InvalidArgumentException('Header values must be RFC 7230 compatible strings.'); |
113 | 113 | } |
114 | 114 | |
115 | - $returnValues[] = trim((string)$v); |
|
115 | + $returnValues[] = trim((string) $v); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | return $returnValues; |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | protected function setHeaders(array $headers): void |
128 | 128 | { |
129 | 129 | foreach ($headers as $name => $values) { |
130 | - $values = (array)$values; |
|
131 | - $name = strtolower((string)$name); |
|
130 | + $values = (array) $values; |
|
131 | + $name = strtolower((string) $name); |
|
132 | 132 | |
133 | 133 | if (!$this->hasHeader($name)) { |
134 | 134 | $this->headers[$name] = []; |