@@ -251,7 +251,7 @@ |
||
251 | 251 | bool $assoc = false, |
252 | 252 | int $depth = 512, |
253 | 253 | int $options = 0 |
254 | - ): array|object { |
|
254 | + ): array | object { |
|
255 | 255 | return Json::decode($this->content, $assoc, $depth, $options); |
256 | 256 | } |
257 | 257 |
@@ -54,8 +54,7 @@ |
||
54 | 54 | * @class HttpResponse |
55 | 55 | * @package Platine\Http\Client |
56 | 56 | */ |
57 | -class HttpResponse |
|
58 | -{ |
|
57 | +class HttpResponse { |
|
59 | 58 | /** |
60 | 59 | * The request URL |
61 | 60 | * @var string |
@@ -39,6 +39,5 @@ |
||
39 | 39 | * @class HttpClientException |
40 | 40 | * @package Platine\Http\Client\Exception |
41 | 41 | */ |
42 | -class HttpClientException extends Exception |
|
43 | -{ |
|
42 | +class HttpClientException extends Exception { |
|
44 | 43 | } |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | protected function send(CurlHandle $ch): HttpResponse |
552 | 552 | { |
553 | 553 | $responseHeaders = []; |
554 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$responseHeaders) { |
|
554 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$responseHeaders) { |
|
555 | 555 | if (strpos($header, ':') !== false) { |
556 | 556 | list($name, $value) = explode(':', $header); |
557 | 557 | if (array_key_exists($name, $responseHeaders) === false) { |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | * @param array<mixed>|object|null $body the request body |
681 | 681 | * @return void |
682 | 682 | */ |
683 | - protected function processBody(CurlHandle $ch, array|object|null $body = null): void |
|
683 | + protected function processBody(CurlHandle $ch, array | object | null $body = null): void |
|
684 | 684 | { |
685 | 685 | if ($body === null) { |
686 | 686 | return; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * {@inheritdoc} |
141 | 141 | * @return $this |
142 | 142 | */ |
143 | - public function withHeader(string $name, string|array $value): self |
|
143 | + public function withHeader(string $name, string | array $value): self |
|
144 | 144 | { |
145 | 145 | $that = clone $this; |
146 | 146 | $lowerName = strtolower($name); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | /** |
153 | 153 | * {@inheritdoc} |
154 | 154 | */ |
155 | - public function withAddedHeader(string $name, string|array $value): self |
|
155 | + public function withAddedHeader(string $name, string | array $value): self |
|
156 | 156 | { |
157 | 157 | $that = clone $this; |
158 | 158 | $lowerName = strtolower($name); |
@@ -51,8 +51,7 @@ |
||
51 | 51 | * @class Message |
52 | 52 | * @package Platine\Http |
53 | 53 | */ |
54 | -abstract class Message implements MessageInterface |
|
55 | -{ |
|
54 | +abstract class Message implements MessageInterface { |
|
56 | 55 | /** |
57 | 56 | * The message protocol version. |
58 | 57 | * @var string |
@@ -80,7 +80,7 @@ |
||
80 | 80 | */ |
81 | 81 | public function __construct( |
82 | 82 | string $method = 'GET', |
83 | - UriInterface|string|null $uri = null |
|
83 | + UriInterface | string | null $uri = null |
|
84 | 84 | ) { |
85 | 85 | $this->method = $this->filterMethod($method); |
86 | 86 | if ($uri === null) { |
@@ -53,8 +53,7 @@ |
||
53 | 53 | * @class Request |
54 | 54 | * @package Platine\Http |
55 | 55 | */ |
56 | -class Request extends Message implements RequestInterface |
|
57 | -{ |
|
56 | +class Request extends Message implements RequestInterface { |
|
58 | 57 | /** |
59 | 58 | * The request target |
60 | 59 | * @var string |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | |
517 | 517 | return (string) preg_replace_callback( |
518 | 518 | '/(?:[^a-zA-Z0-9\-._~!$&\'()*+,;=:@\/%]++|%(?![a-fA-F0-9]{2}))/', |
519 | - function ($matches) { |
|
519 | + function($matches) { |
|
520 | 520 | return rawurlencode($matches[0]); |
521 | 521 | }, |
522 | 522 | $path |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | |
548 | 548 | return (string) preg_replace_callback( |
549 | 549 | '/(?:[^a-zA-Z0-9\-._~!$&\'()*+,;=:@\/?%]++|%(?![a-fA-F0-9]{2}))/', |
550 | - function ($matches) { |
|
550 | + function($matches) { |
|
551 | 551 | return rawurlencode($matches[0]); |
552 | 552 | }, |
553 | 553 | $query |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | if ($fragment !== '') { |
568 | 568 | return (string) preg_replace_callback( |
569 | 569 | '/(?:[^a-zA-Z0-9\-._~!$&\'()*+,;=:@\/?%]++|%(?![a-fA-F0-9]{2}))/', |
570 | - function ($matches) { |
|
570 | + function($matches) { |
|
571 | 571 | return rawurlencode($matches[0]); |
572 | 572 | }, |
573 | 573 | $fragment |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | * @class Uri |
54 | 54 | * @package Platine\Http |
55 | 55 | */ |
56 | -class Uri implements UriInterface |
|
57 | -{ |
|
56 | +class Uri implements UriInterface { |
|
58 | 57 | /** |
59 | 58 | * The Uri scheme |
60 | 59 | * @var string |
@@ -101,8 +100,7 @@ discard block |
||
101 | 100 | * Create new Uri instance |
102 | 101 | * @param string $uri |
103 | 102 | */ |
104 | - public function __construct(string $uri = '') |
|
105 | - { |
|
103 | + public function __construct(string $uri = '') { |
|
106 | 104 | if ($uri !== '') { |
107 | 105 | $parts = parse_url($uri); |
108 | 106 |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | * @class Response |
54 | 54 | * @package Platine\Http |
55 | 55 | */ |
56 | -class Response extends Message implements ResponseInterface |
|
57 | -{ |
|
56 | +class Response extends Message implements ResponseInterface { |
|
58 | 57 | /** |
59 | 58 | * The reason phrases. |
60 | 59 | */ |
@@ -155,8 +154,7 @@ discard block |
||
155 | 154 | * @param int $statusCode |
156 | 155 | * @param string $reasonPhrase |
157 | 156 | */ |
158 | - public function __construct(int $statusCode = 200, string $reasonPhrase = '') |
|
159 | - { |
|
157 | + public function __construct(int $statusCode = 200, string $reasonPhrase = '') { |
|
160 | 158 | $this->statusCode = $this->filterStatusCode($statusCode); |
161 | 159 | if ($reasonPhrase === '') { |
162 | 160 | $reasonPhrase = static::REASON_PHRASES[$this->statusCode] ?? ''; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * The parse body content |
85 | 85 | * @var object|array<string, mixed>|null |
86 | 86 | */ |
87 | - protected object|array|null $parsedBody; |
|
87 | + protected object | array | null $parsedBody; |
|
88 | 88 | |
89 | 89 | /** |
90 | 90 | * The array of request attributes |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function __construct( |
102 | 102 | string $method = 'GET', |
103 | - UriInterface|string|null $uri = null, |
|
103 | + UriInterface | string | null $uri = null, |
|
104 | 104 | array $serverParams = [] |
105 | 105 | ) { |
106 | 106 | $this->serverParams = $serverParams; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | /** |
226 | 226 | * {@inheritdoc} |
227 | 227 | */ |
228 | - public function getParsedBody(): array|object|null |
|
228 | + public function getParsedBody(): array | object | null |
|
229 | 229 | { |
230 | 230 | return $this->parsedBody; |
231 | 231 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | /** |
234 | 234 | * {@inheritdoc} |
235 | 235 | */ |
236 | - public function withParsedBody(array|object|null $data): self |
|
236 | + public function withParsedBody(array | object | null $data): self |
|
237 | 237 | { |
238 | 238 | $that = clone $this; |
239 | 239 | $that->parsedBody = $data; |
@@ -54,8 +54,7 @@ |
||
54 | 54 | * @class ServerRequest |
55 | 55 | * @package Platine\Http |
56 | 56 | */ |
57 | -class ServerRequest extends Request implements ServerRequestInterface |
|
58 | -{ |
|
57 | +class ServerRequest extends Request implements ServerRequestInterface { |
|
59 | 58 | /** |
60 | 59 | * The array of servers parameters |
61 | 60 | * @var array<string, mixed> |
@@ -108,7 +108,7 @@ |
||
108 | 108 | * @param string|null $clientMediaType |
109 | 109 | */ |
110 | 110 | public function __construct( |
111 | - string|StreamInterface $filenameOrStream, |
|
111 | + string | StreamInterface $filenameOrStream, |
|
112 | 112 | ?int $size = null, |
113 | 113 | int $error = UPLOAD_ERR_OK, |
114 | 114 | ?string $clientFilename = null, |
@@ -54,8 +54,7 @@ |
||
54 | 54 | * @class UploadedFile |
55 | 55 | * @package Platine\Http |
56 | 56 | */ |
57 | -class UploadedFile implements UploadedFileInterface |
|
58 | -{ |
|
57 | +class UploadedFile implements UploadedFileInterface { |
|
59 | 58 | /** |
60 | 59 | * The uploaded file name |
61 | 60 | * @var string |