@@ -80,6 +80,6 @@ |
||
80 | 80 | $this->operation = static::CAN_RENAME_FILE; |
81 | 81 | $this->allow = !$this->allow; |
82 | 82 | } |
83 | - return ($this->allow ? static::ALLOW : static::DISCARD) . $this->operation ; |
|
83 | + return ($this->allow ? static::ALLOW : static::DISCARD) . $this->operation; |
|
84 | 84 | } |
85 | 85 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | throw new RequestException($this->lang->rrHttpAnswerHeaderTooLarge($this->maxHeaderSize, $headerSize)); |
90 | 90 | } |
91 | 91 | rewind($message); |
92 | - $this->parseHeader((string)stream_get_contents($message, $headerSize, 0)); |
|
92 | + $this->parseHeader((string) stream_get_contents($message, $headerSize, 0)); |
|
93 | 93 | if ($onlyHeader) { |
94 | 94 | return; |
95 | 95 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | if ($this->bodySizeMightBeTooLarge()) { |
99 | 99 | $this->processStreamBody($message, $headerSize); |
100 | 100 | } else { |
101 | - $this->processStringBody((string)stream_get_contents($message, -1, $headerSize)); |
|
101 | + $this->processStringBody((string) stream_get_contents($message, -1, $headerSize)); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | public function getHeader(string $key, ?string $default = null): ?string |
173 | 173 | { |
174 | - return isset($this->headers[$key])? (string)reset($this->headers[$key]) : $default; |
|
174 | + return isset($this->headers[$key]) ? (string) reset($this->headers[$key]) : $default; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function getHeaders(string $key): array |
182 | 182 | { |
183 | - return isset($this->headers[$key])? $this->headers[$key] : []; |
|
183 | + return isset($this->headers[$key]) ? $this->headers[$key] : []; |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -41,7 +41,7 @@ |
||
41 | 41 | if (empty($headers)) { |
42 | 42 | return []; |
43 | 43 | } |
44 | - return array_map(function ($enc) { |
|
44 | + return array_map(function($enc) { |
|
45 | 45 | return trim(mb_strtolower($enc)); |
46 | 46 | }, explode(',', $headers)); |
47 | 47 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | protected function getStreamHeader(string $key, ?string $default = null): ?string |
37 | 37 | { |
38 | 38 | $headers = $this->getAllHeaders(); |
39 | - return isset($headers[$key])? (string)reset($headers[$key]) : $default; |
|
39 | + return isset($headers[$key]) ? (string) reset($headers[$key]) : $default; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -41,7 +41,7 @@ |
||
41 | 41 | if (empty($headers)) { |
42 | 42 | return []; |
43 | 43 | } |
44 | - return array_map(function ($enc) { |
|
44 | + return array_map(function($enc) { |
|
45 | 45 | return trim(mb_strtolower($enc)); |
46 | 46 | }, explode(',', $headers)); |
47 | 47 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | protected function getStringHeader(string $key, ?string $default = null): ?string |
33 | 33 | { |
34 | 34 | $headers = $this->getAllHeaders(); |
35 | - return isset($headers[$key])? (string)reset($headers[$key]) : $default; |
|
35 | + return isset($headers[$key]) ? (string) reset($headers[$key]) : $default; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -23,12 +23,12 @@ |
||
23 | 23 | |
24 | 24 | public function getFilename(): string |
25 | 25 | { |
26 | - return (string)$this->filename; |
|
26 | + return (string) $this->filename; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | public function getMimeType(): string |
30 | 30 | { |
31 | - return (string)$this->mime; |
|
31 | + return (string) $this->mime; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | public function getContent(): string |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function addValues($array): self |
151 | 151 | { |
152 | - array_walk($array, function ($value, $key) { |
|
152 | + array_walk($array, function($value, $key) { |
|
153 | 153 | $this->addValue($key, $value); |
154 | 154 | }); |
155 | 155 | return $this; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function addValue(string $key, $value): self |
165 | 165 | { |
166 | - $this->content[$key] = ($value instanceof Query\Value) ? $value : new Query\Value((string)$value); |
|
166 | + $this->content[$key] = ($value instanceof Query\Value) ? $value : new Query\Value((string) $value); |
|
167 | 167 | return $this; |
168 | 168 | } |
169 | 169 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | protected function prepareBoundary(): self |
229 | 229 | { |
230 | - $this->boundary = $this->isMultipart() ? $this->generateBoundary() : null ; |
|
230 | + $this->boundary = $this->isMultipart() ? $this->generateBoundary() : null; |
|
231 | 231 | return $this; |
232 | 232 | } |
233 | 233 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | if ($this->isMultipart()) { |
243 | 243 | $this->createMultipartRequest(); |
244 | 244 | } else { |
245 | - $this->contentLength += (int)fwrite($this->contentStream, $this->getSimpleRequest()); |
|
245 | + $this->contentLength += (int) fwrite($this->contentStream, $this->getSimpleRequest()); |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | return $this; |
@@ -309,21 +309,21 @@ discard block |
||
309 | 309 | protected function createMultipartRequest(): string |
310 | 310 | { |
311 | 311 | foreach ($this->content as $key => $value) { |
312 | - $this->contentLength += (int)fwrite($this->contentStream, '--' . $this->boundary . Http::DELIMITER); |
|
312 | + $this->contentLength += (int) fwrite($this->contentStream, '--' . $this->boundary . Http::DELIMITER); |
|
313 | 313 | if ($value instanceof Query\File) { |
314 | 314 | $filename = empty($value->getFilename()) ? '' : '; filename="' . urlencode($value->getFilename()) . '"'; |
315 | - $this->contentLength += (int)fwrite($this->contentStream, 'Content-Disposition: form-data; name="' . urlencode($key) . '"' . $filename . Http::DELIMITER); |
|
316 | - $this->contentLength += (int)fwrite($this->contentStream, 'Content-Type: ' . $value->getMimeType() . Http::DELIMITER . Http::DELIMITER); |
|
315 | + $this->contentLength += (int) fwrite($this->contentStream, 'Content-Disposition: form-data; name="' . urlencode($key) . '"' . $filename . Http::DELIMITER); |
|
316 | + $this->contentLength += (int) fwrite($this->contentStream, 'Content-Type: ' . $value->getMimeType() . Http::DELIMITER . Http::DELIMITER); |
|
317 | 317 | $source = $value->getStream(); |
318 | 318 | rewind($source); |
319 | - $this->contentLength += (int)stream_copy_to_stream($source, $this->contentStream); |
|
320 | - $this->contentLength += (int)fwrite($this->contentStream, Http::DELIMITER); |
|
319 | + $this->contentLength += (int) stream_copy_to_stream($source, $this->contentStream); |
|
320 | + $this->contentLength += (int) fwrite($this->contentStream, Http::DELIMITER); |
|
321 | 321 | } else { |
322 | - $this->contentLength += (int)fwrite($this->contentStream, 'Content-Disposition: form-data; name="' . urlencode($key) . '"' . Http::DELIMITER . Http::DELIMITER); |
|
323 | - $this->contentLength += (int)fwrite($this->contentStream, $value->getContent() . Http::DELIMITER); |
|
322 | + $this->contentLength += (int) fwrite($this->contentStream, 'Content-Disposition: form-data; name="' . urlencode($key) . '"' . Http::DELIMITER . Http::DELIMITER); |
|
323 | + $this->contentLength += (int) fwrite($this->contentStream, $value->getContent() . Http::DELIMITER); |
|
324 | 324 | } |
325 | 325 | } |
326 | - $this->contentLength += (int)fwrite($this->contentStream, '--' . $this->boundary . '--' . Http::DELIMITER); |
|
326 | + $this->contentLength += (int) fwrite($this->contentStream, '--' . $this->boundary . '--' . Http::DELIMITER); |
|
327 | 327 | return ''; |
328 | 328 | } |
329 | 329 | |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | */ |
348 | 348 | protected function getQueryHeaders(): string |
349 | 349 | { |
350 | - return implode(Http::DELIMITER, array_map(function ($key, $value) { |
|
350 | + return implode(Http::DELIMITER, array_map(function($key, $value) { |
|
351 | 351 | return sprintf('%s: %s', $key, $value); |
352 | 352 | }, array_keys($this->headers), array_values($this->headers))); |
353 | 353 | } |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | { |
370 | 370 | $requestPart = ''; |
371 | 371 | if ($this->isInline() && !empty($this->content)) { |
372 | - $requestPart .= (false === mb_strpos($this->path, '?')) ? '?' : '&' ; |
|
372 | + $requestPart .= (false === mb_strpos($this->path, '?')) ? '?' : '&'; |
|
373 | 373 | $requestPart .= $this->getSimpleRequest(); |
374 | 374 | } |
375 | 375 | return $this->path . $requestPart; |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | */ |
382 | 382 | protected function getSimpleRequest(): string |
383 | 383 | { |
384 | - return implode('&', array_map(function ($key, Http\Query\Value $value) { |
|
384 | + return implode('&', array_map(function($key, Http\Query\Value $value) { |
|
385 | 385 | return sprintf('%s=%s', urlencode($key), urlencode($value->getContent())); |
386 | 386 | }, array_keys($this->content), array_values($this->content))); |
387 | 387 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | public function getHost(): string |
52 | 52 | { |
53 | 53 | $host = '' . $this->host; |
54 | - return (preg_match('#^[0-9a-f:]+$#', $host) ? '[' . $host .']' : $host ); // IPv6 |
|
54 | + return (preg_match('#^[0-9a-f:]+$#', $host) ? '[' . $host . ']' : $host); // IPv6 |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | public function getPort(): ?int |