@@ -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 | |
@@ -54,8 +54,7 @@ discard block |
||
| 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 |
@@ -189,8 +188,7 @@ discard block |
||
| 189 | 188 | * @param string $name |
| 190 | 189 | * @return mixed|null |
| 191 | 190 | */ |
| 192 | - public function getHeader(string $name) |
|
| 193 | - { |
|
| 191 | + public function getHeader(string $name) { |
|
| 194 | 192 | return $this->headers[$name] ?? null; |
| 195 | 193 | } |
| 196 | 194 | |
@@ -259,8 +257,7 @@ discard block |
||
| 259 | 257 | * Return the response as XML |
| 260 | 258 | * @return mixed |
| 261 | 259 | */ |
| 262 | - public function xml() |
|
| 263 | - { |
|
| 260 | + public function xml() { |
|
| 264 | 261 | return Xml::decode($this->content); |
| 265 | 262 | } |
| 266 | 263 | |