@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | // Informational 1xx |
17 | 17 | 100 => 'Continue', |
18 | 18 | 101 => 'Switching Protocols', |
19 | - 102 => 'Processing', // RFC2518 |
|
19 | + 102 => 'Processing', // RFC2518 |
|
20 | 20 | // Success 2xx |
21 | 21 | 200 => 'OK', |
22 | 22 | 201 => 'Created', |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | 204 => 'No Content', |
26 | 26 | 205 => 'Reset Content', |
27 | 27 | 206 => 'Partial Content', |
28 | - 207 => 'Multi-Status', // RFC4918 |
|
29 | - 208 => 'Already Reported', // RFC5842 |
|
30 | - 226 => 'IM Used', // RFC3229 |
|
28 | + 207 => 'Multi-Status', // RFC4918 |
|
29 | + 208 => 'Already Reported', // RFC5842 |
|
30 | + 226 => 'IM Used', // RFC3229 |
|
31 | 31 | // Redirection 3xx |
32 | 32 | 300 => 'Multiple Choices', |
33 | 33 | 301 => 'Moved Permanently', |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 305 => 'Use Proxy', |
38 | 38 | // 306 is deprecated but reserved |
39 | 39 | 307 => 'Temporary Redirect', |
40 | - 308 => 'Permanent Redirect', // RFC7238 |
|
40 | + 308 => 'Permanent Redirect', // RFC7238 |
|
41 | 41 | // Client Error 4xx |
42 | 42 | 400 => 'Bad Request', |
43 | 43 | 401 => 'Unauthorized', |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | 415 => 'Unsupported Media Type', |
58 | 58 | 416 => 'Range Not Satisfiable', |
59 | 59 | 417 => 'Expectation Failed', |
60 | - 422 => 'Unprocessable Entity', // RFC4918 |
|
61 | - 423 => 'Locked', // RFC4918 |
|
62 | - 424 => 'Failed Dependency', // RFC4918 |
|
63 | - 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 |
|
64 | - 426 => 'Upgrade Required', // RFC2817 |
|
65 | - 428 => 'Precondition Required', // RFC6585 |
|
66 | - 429 => 'Too Many Requests', // RFC6585 |
|
67 | - 431 => 'Request Header Fields Too Large', // RFC6585 |
|
60 | + 422 => 'Unprocessable Entity', // RFC4918 |
|
61 | + 423 => 'Locked', // RFC4918 |
|
62 | + 424 => 'Failed Dependency', // RFC4918 |
|
63 | + 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 |
|
64 | + 426 => 'Upgrade Required', // RFC2817 |
|
65 | + 428 => 'Precondition Required', // RFC6585 |
|
66 | + 429 => 'Too Many Requests', // RFC6585 |
|
67 | + 431 => 'Request Header Fields Too Large', // RFC6585 |
|
68 | 68 | // Server Error 5xx |
69 | 69 | 500 => 'Internal Server Error', |
70 | 70 | 501 => 'Not Implemented', |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | 503 => 'Service Unavailable', |
73 | 73 | 504 => 'Gateway Timeout', |
74 | 74 | 505 => 'HTTP Version Not Supported', |
75 | - 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 |
|
76 | - 507 => 'Insufficient Storage', // RFC4918 |
|
77 | - 508 => 'Loop Detected', // RFC5842 |
|
78 | - 510 => 'Not Extended', // RFC2774 |
|
79 | - 511 => 'Network Authentication Required', // RFC6585 |
|
75 | + 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 |
|
76 | + 507 => 'Insufficient Storage', // RFC4918 |
|
77 | + 508 => 'Loop Detected', // RFC5842 |
|
78 | + 510 => 'Not Extended', // RFC2774 |
|
79 | + 511 => 'Network Authentication Required', // RFC6585 |
|
80 | 80 | ]; |
81 | 81 | |
82 | 82 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | private $options; |
103 | 103 | |
104 | - public function __construct(array $options = []) |
|
104 | + public function __construct(array $options = [ ]) |
|
105 | 105 | { |
106 | 106 | $this->curl = curl_init(); |
107 | 107 | $this->options = $options; |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | ]; |
119 | 119 | |
120 | 120 | if ($data) { |
121 | - $options[CURLOPT_POST] = true; |
|
122 | - $options[CURLOPT_POSTFIELDS] = $data; |
|
121 | + $options[ CURLOPT_POST ] = true; |
|
122 | + $options[ CURLOPT_POSTFIELDS ] = $data; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return self::jsonValidate($this->execute($options)); |
@@ -185,13 +185,13 @@ discard block |
||
185 | 185 | */ |
186 | 186 | private static function curlValidate($curl, $response = null) |
187 | 187 | { |
188 | - $json = json_decode((string) $response, true) ?: []; |
|
188 | + $json = json_decode((string) $response, true) ?: [ ]; |
|
189 | 189 | |
190 | 190 | if (($httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE)) |
191 | - && !in_array($httpCode, [self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE]) |
|
191 | + && !in_array($httpCode, [ self::DEFAULT_STATUS_CODE, self::NOT_MODIFIED_STATUS_CODE ]) |
|
192 | 192 | ) { |
193 | - $errorDescription = array_key_exists('description', $json) ? $json['description'] : self::$codes[$httpCode]; |
|
194 | - $errorParameters = array_key_exists('parameters', $json) ? $json['parameters'] : []; |
|
193 | + $errorDescription = array_key_exists('description', $json) ? $json[ 'description' ] : self::$codes[ $httpCode ]; |
|
194 | + $errorParameters = array_key_exists('parameters', $json) ? $json[ 'parameters' ] : [ ]; |
|
195 | 195 | |
196 | 196 | throw new HttpException($errorDescription, $httpCode, null, $errorParameters); |
197 | 197 | } |
@@ -207,16 +207,16 @@ discard block |
||
207 | 207 | public function setProxy($proxyString = '', $socks5 = false) |
208 | 208 | { |
209 | 209 | if (empty($proxyString)) { |
210 | - unset($this->options[CURLOPT_PROXY], $this->options[CURLOPT_HTTPPROXYTUNNEL], $this->options[CURLOPT_PROXYTYPE]); |
|
210 | + unset($this->options[ CURLOPT_PROXY ], $this->options[ CURLOPT_HTTPPROXYTUNNEL ], $this->options[ CURLOPT_PROXYTYPE ]); |
|
211 | 211 | |
212 | 212 | return; |
213 | 213 | } |
214 | 214 | |
215 | - $this->options[CURLOPT_PROXY] = $proxyString; |
|
216 | - $this->options[CURLOPT_HTTPPROXYTUNNEL] = true; |
|
215 | + $this->options[ CURLOPT_PROXY ] = $proxyString; |
|
216 | + $this->options[ CURLOPT_HTTPPROXYTUNNEL ] = true; |
|
217 | 217 | |
218 | 218 | if ($socks5) { |
219 | - $this->options[CURLOPT_PROXYTYPE] = CURLPROXY_SOCKS5; |
|
219 | + $this->options[ CURLOPT_PROXYTYPE ] = CURLPROXY_SOCKS5; |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function setOption($option, $value) |
229 | 229 | { |
230 | - $this->options[$option] = $value; |
|
230 | + $this->options[ $option ] = $value; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function unsetOption($option) |
238 | 238 | { |
239 | - unset($this->options[$option]); |
|
239 | + unset($this->options[ $option ]); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -244,6 +244,6 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function resetOptions() |
246 | 246 | { |
247 | - $this->options = []; |
|
247 | + $this->options = [ ]; |
|
248 | 248 | } |
249 | 249 | } |