@@ -67,8 +67,7 @@ |
||
67 | 67 | * |
68 | 68 | * @see http://tools.ietf.org/html/rfc3986 (the URI specification) |
69 | 69 | */ |
70 | -interface UriInterface |
|
71 | -{ |
|
70 | +interface UriInterface { |
|
72 | 71 | /** |
73 | 72 | * Retrieve the scheme component of the URI. |
74 | 73 | * |
@@ -198,10 +198,10 @@ |
||
198 | 198 | |
199 | 199 | if ($size === null) { |
200 | 200 | $that = $that->withHeader('Transfer-Encoding', 'chunked') |
201 | - ->withoutHeader('Content-Length'); |
|
201 | + ->withoutHeader('Content-Length'); |
|
202 | 202 | } else { |
203 | 203 | $that = $that->withHeader('Content-Length', (string) $size) |
204 | - ->withoutHeader('Transfer-Encoding'); |
|
204 | + ->withoutHeader('Transfer-Encoding'); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | return $that; |
@@ -47,8 +47,7 @@ |
||
47 | 47 | |
48 | 48 | namespace Platine\Http; |
49 | 49 | |
50 | -abstract class Message implements MessageInterface |
|
51 | -{ |
|
50 | +abstract class Message implements MessageInterface { |
|
52 | 51 | /** |
53 | 52 | * The message protocol version. |
54 | 53 | * @var string |
@@ -51,8 +51,7 @@ discard block |
||
51 | 51 | * @class Request |
52 | 52 | * @package Platine\Http |
53 | 53 | */ |
54 | -class Request extends Message implements RequestInterface |
|
55 | -{ |
|
54 | +class Request extends Message implements RequestInterface { |
|
56 | 55 | /** |
57 | 56 | * The request target |
58 | 57 | * @var string |
@@ -76,8 +75,7 @@ discard block |
||
76 | 75 | * @param string $method the HTTP request method |
77 | 76 | * @param UriInterface|string|null $uri the request Uri |
78 | 77 | */ |
79 | - public function __construct(string $method = 'GET', $uri = null) |
|
80 | - { |
|
78 | + public function __construct(string $method = 'GET', $uri = null) { |
|
81 | 79 | $this->method = $this->filterMethod($method); |
82 | 80 | if ($uri === null) { |
83 | 81 | $uri = new Uri(); |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | use InvalidArgumentException; |
52 | 52 | |
53 | -class ServerRequest extends Request implements ServerRequestInterface |
|
54 | -{ |
|
53 | +class ServerRequest extends Request implements ServerRequestInterface { |
|
55 | 54 | /** |
56 | 55 | * The array of servers params |
57 | 56 | * @var array<string, mixed> |
@@ -221,8 +220,7 @@ discard block |
||
221 | 220 | /** |
222 | 221 | * {@inheritdoc} |
223 | 222 | */ |
224 | - public function getParsedBody() |
|
225 | - { |
|
223 | + public function getParsedBody() { |
|
226 | 224 | return $this->parsedBody; |
227 | 225 | } |
228 | 226 | |
@@ -248,8 +246,7 @@ discard block |
||
248 | 246 | /** |
249 | 247 | * {@inheritdoc} |
250 | 248 | */ |
251 | - public function getAttribute(string $name, $default = null) |
|
252 | - { |
|
249 | + public function getAttribute(string $name, $default = null) { |
|
253 | 250 | return isset($this->attributes[$name]) ? $this->attributes[$name] : $default; |
254 | 251 | } |
255 | 252 | |
@@ -301,8 +298,7 @@ discard block |
||
301 | 298 | * @param object|array<string|int, mixed>|mixed|null $data the parsed body |
302 | 299 | * @return mixed |
303 | 300 | */ |
304 | - protected function filterParsedBody($data) |
|
305 | - { |
|
301 | + protected function filterParsedBody($data) { |
|
306 | 302 | if ($data !== null && !is_array($data) && !is_object($data)) { |
307 | 303 | throw new InvalidArgumentException('Invalid parsed body! Parsed body must be an array or an object'); |
308 | 304 | } |
@@ -51,8 +51,7 @@ discard block |
||
51 | 51 | * @class HttpCookie |
52 | 52 | * @package Platine\Http\Client |
53 | 53 | */ |
54 | -class HttpCookie |
|
55 | -{ |
|
54 | +class HttpCookie { |
|
56 | 55 | /** |
57 | 56 | * The name of cookie |
58 | 57 | * @var string |
@@ -112,8 +111,7 @@ discard block |
||
112 | 111 | * Create new instance |
113 | 112 | * @param string $cookieString |
114 | 113 | */ |
115 | - public function __construct(string $cookieString) |
|
116 | - { |
|
114 | + public function __construct(string $cookieString) { |
|
117 | 115 | $parts = array_map('trim', explode(';', $cookieString)); |
118 | 116 | foreach ($parts as $partStr) { |
119 | 117 | $part = array_map('trim', explode('=', $partStr)); |
@@ -51,8 +51,7 @@ |
||
51 | 51 | * @class HttpMethod |
52 | 52 | * @package Platine\Http\Client |
53 | 53 | */ |
54 | -class HttpMethod |
|
55 | -{ |
|
54 | +class HttpMethod { |
|
56 | 55 | public const HEAD = 'HEAD'; |
57 | 56 | public const GET = 'GET'; |
58 | 57 | public const PUT = 'PUT'; |
@@ -57,8 +57,7 @@ |
||
57 | 57 | * @class HttpStatus |
58 | 58 | * @package Platine\Http\Client |
59 | 59 | */ |
60 | -class HttpStatus |
|
61 | -{ |
|
60 | +class HttpStatus { |
|
62 | 61 | // Informational 1xx: |
63 | 62 | public const INFORMATIONAL = 100; |
64 | 63 | public const CONTINUE = 100; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | { |
62 | 62 | // Informational 1xx: |
63 | 63 | public const INFORMATIONAL = 100; |
64 | - public const CONTINUE = 100; |
|
64 | + public const continue = 100; |
|
65 | 65 | public const SWITCHING_PROTOCOLS = 101; |
66 | 66 | |
67 | 67 | // Successful 2xx: |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | public const SERVER_ERROR_END = 600; |
118 | 118 | |
119 | 119 | public const REASON_PHRASES = [ |
120 | - self::CONTINUE => 'Continue', |
|
120 | + self::continue => 'Continue', |
|
121 | 121 | self::SWITCHING_PROTOCOLS => 'Switching Protocols', |
122 | 122 | |
123 | 123 | self::OK => 'OK', |
@@ -39,6 +39,5 @@ |
||
39 | 39 | * @class HttpClientException |
40 | 40 | * @package Platine\Http\Client |
41 | 41 | */ |
42 | -class HttpClientException extends Exception |
|
43 | -{ |
|
42 | +class HttpClientException extends Exception { |
|
44 | 43 | } |
@@ -270,8 +270,8 @@ |
||
270 | 270 | */ |
271 | 271 | public function contentType(string $contentType): self |
272 | 272 | { |
273 | - // If this is a multipart request and boundary was not defined, |
|
274 | - // we define a boundary as this is required for multipart requests. |
|
273 | + // If this is a multipart request and boundary was not defined, |
|
274 | + // we define a boundary as this is required for multipart requests. |
|
275 | 275 | if (stripos($contentType, 'multipart/') !== false) { |
276 | 276 | if (stripos($contentType, 'boundary') === false) { |
277 | 277 | $contentType .= sprintf('; boundary="%s"', uniqid((string) time())); |
@@ -518,7 +518,7 @@ |
||
518 | 518 | protected function send($ch): HttpResponse |
519 | 519 | { |
520 | 520 | $responseHeaders = []; |
521 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$responseHeaders) { |
|
521 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$responseHeaders) { |
|
522 | 522 | if (strpos($header, ':') !== false) { |
523 | 523 | list($name, $value) = explode(':', $header); |
524 | 524 | if (array_key_exists($name, $responseHeaders) === false) { |
@@ -55,8 +55,7 @@ discard block |
||
55 | 55 | * @class HttpClient |
56 | 56 | * @package Platine\Http\Client |
57 | 57 | */ |
58 | -class HttpClient |
|
59 | -{ |
|
58 | +class HttpClient { |
|
60 | 59 | /** |
61 | 60 | * The base URL |
62 | 61 | * @var string |
@@ -109,8 +108,7 @@ discard block |
||
109 | 108 | * Create new instance |
110 | 109 | * @param string $baseUrl |
111 | 110 | */ |
112 | - public function __construct(string $baseUrl = '') |
|
113 | - { |
|
111 | + public function __construct(string $baseUrl = '') { |
|
114 | 112 | $this->baseUrl = $baseUrl; |
115 | 113 | } |
116 | 114 |