@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | * @class HttpCookie |
53 | 53 | * @package Platine\Framework\Http\Client |
54 | 54 | */ |
55 | -class HttpCookie |
|
56 | -{ |
|
55 | +class HttpCookie { |
|
57 | 56 | /** |
58 | 57 | * The name of cookie |
59 | 58 | * @var string |
@@ -113,8 +112,7 @@ discard block |
||
113 | 112 | * Create new instance |
114 | 113 | * @param string $cookieString |
115 | 114 | */ |
116 | - public function __construct(string $cookieString) |
|
117 | - { |
|
115 | + public function __construct(string $cookieString) { |
|
118 | 116 | $parts = array_map('trim', explode(';', $cookieString)); |
119 | 117 | foreach ($parts as $partStr) { |
120 | 118 | $part = array_map('trim', explode('=', $partStr)); |
@@ -55,8 +55,7 @@ discard block |
||
55 | 55 | * @class HttpResponse |
56 | 56 | * @package Platine\Framework\Http\Client |
57 | 57 | */ |
58 | -class HttpResponse |
|
59 | -{ |
|
58 | +class HttpResponse { |
|
60 | 59 | /** |
61 | 60 | * The request URL |
62 | 61 | * @var string |
@@ -180,8 +179,7 @@ discard block |
||
180 | 179 | * @param string $name |
181 | 180 | * @return mixed|null |
182 | 181 | */ |
183 | - public function getHeader(string $name) |
|
184 | - { |
|
182 | + public function getHeader(string $name) { |
|
185 | 183 | return $this->headers[$name] ?? null; |
186 | 184 | } |
187 | 185 | |
@@ -250,8 +248,7 @@ discard block |
||
250 | 248 | * Return the response as XML |
251 | 249 | * @return mixed |
252 | 250 | */ |
253 | - public function xml() |
|
254 | - { |
|
251 | + public function xml() { |
|
255 | 252 | return Xml::decode($this->content); |
256 | 253 | } |
257 | 254 |
@@ -40,6 +40,5 @@ |
||
40 | 40 | * @class HttpClientException |
41 | 41 | * @package Platine\Framework\Http\Client |
42 | 42 | */ |
43 | -class HttpClientException extends Exception |
|
44 | -{ |
|
43 | +class HttpClientException extends Exception { |
|
45 | 44 | } |
@@ -58,8 +58,7 @@ |
||
58 | 58 | * @class HttpStatus |
59 | 59 | * @package Platine\Framework\Http\Client |
60 | 60 | */ |
61 | -class HttpStatus |
|
62 | -{ |
|
61 | +class HttpStatus { |
|
63 | 62 | // Informational 1xx: |
64 | 63 | public const INFORMATIONAL = 100; |
65 | 64 | public const CONTINUE = 100; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | // Informational 1xx: |
64 | 64 | public const INFORMATIONAL = 100; |
65 | - public const CONTINUE = 100; |
|
65 | + public const continue = 100; |
|
66 | 66 | public const SWITCHING_PROTOCOLS = 101; |
67 | 67 | |
68 | 68 | // Successful 2xx: |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public const SERVER_ERROR_END = 600; |
119 | 119 | |
120 | 120 | public const REASON_PHRASES = [ |
121 | - self::CONTINUE => 'Continue', |
|
121 | + self::continue => 'Continue', |
|
122 | 122 | self::SWITCHING_PROTOCOLS => 'Switching Protocols', |
123 | 123 | |
124 | 124 | self::OK => 'OK', |
@@ -271,8 +271,8 @@ |
||
271 | 271 | */ |
272 | 272 | public function contentType(string $contentType): self |
273 | 273 | { |
274 | - // If this is a multipart request and boundary was not defined, |
|
275 | - // we define a boundary as this is required for multipart requests. |
|
274 | + // If this is a multipart request and boundary was not defined, |
|
275 | + // we define a boundary as this is required for multipart requests. |
|
276 | 276 | if (stripos($contentType, 'multipart/') !== false) { |
277 | 277 | if (stripos($contentType, 'boundary') === false) { |
278 | 278 | $contentType .= sprintf('; boundary="%s"', uniqid((string) time())); |
@@ -519,7 +519,7 @@ |
||
519 | 519 | protected function send($ch): HttpResponse |
520 | 520 | { |
521 | 521 | $responseHeaders = []; |
522 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$responseHeaders) { |
|
522 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$responseHeaders) { |
|
523 | 523 | if (strpos($header, ':') !== false) { |
524 | 524 | list($name, $value) = explode(':', $header); |
525 | 525 | if (array_key_exists($name, $responseHeaders) === false) { |
@@ -56,8 +56,7 @@ discard block |
||
56 | 56 | * @class HttpClient |
57 | 57 | * @package Platine\Framework\Http\Client |
58 | 58 | */ |
59 | -class HttpClient |
|
60 | -{ |
|
59 | +class HttpClient { |
|
61 | 60 | /** |
62 | 61 | * The base URL |
63 | 62 | * @var string |
@@ -110,8 +109,7 @@ discard block |
||
110 | 109 | * Create new instance |
111 | 110 | * @param string $baseUrl |
112 | 111 | */ |
113 | - public function __construct(string $baseUrl = '') |
|
114 | - { |
|
112 | + public function __construct(string $baseUrl = '') { |
|
115 | 113 | $this->baseUrl = $baseUrl; |
116 | 114 | } |
117 | 115 |