@@ -87,9 +87,9 @@ |
||
| 87 | 87 | |
| 88 | 88 | $json = self::jsonValidate($content); |
| 89 | 89 | |
| 90 | - if (!\in_array($response->getStatusCode(), [200, 304])) { |
|
| 91 | - $errorDescription = array_key_exists('description', $json) ? $json['description'] : $response->getReasonPhrase(); |
|
| 92 | - $errorParameters = array_key_exists('parameters', $json) ? $json['parameters'] : []; |
|
| 90 | + if (!\in_array($response->getStatusCode(), [ 200, 304 ])) { |
|
| 91 | + $errorDescription = array_key_exists('description', $json) ? $json[ 'description' ] : $response->getReasonPhrase(); |
|
| 92 | + $errorParameters = array_key_exists('parameters', $json) ? $json[ 'parameters' ] : [ ]; |
|
| 93 | 93 | |
| 94 | 94 | throw new HttpException($errorDescription, $response->getStatusCode(), null, $errorParameters); |
| 95 | 95 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | protected function doRequest($url, array $data = null) |
| 28 | 28 | { |
| 29 | - $options = []; |
|
| 29 | + $options = [ ]; |
|
| 30 | 30 | if ($data) { |
| 31 | 31 | $method = 'POST'; |
| 32 | 32 | |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | $formData = new FormDataPart($data); |
| 42 | 42 | |
| 43 | - $options['headers'] = $formData->getPreparedHeaders()->toArray(); |
|
| 44 | - $options['body'] = $formData->toIterable(); |
|
| 43 | + $options[ 'headers' ] = $formData->getPreparedHeaders()->toArray(); |
|
| 44 | + $options[ 'body' ] = $formData->toIterable(); |
|
| 45 | 45 | } else { |
| 46 | 46 | $method = 'GET'; |
| 47 | 47 | } |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | } catch (ExceptionInterface $exception) { |
| 54 | 54 | if ($exception instanceof HttpExceptionInterface) { |
| 55 | 55 | $response = $exception->getResponse()->toArray(false); |
| 56 | - $message = array_key_exists('description', $response) ? $response['description'] : $exception->getMessage(); |
|
| 57 | - $parameters = array_key_exists('parameters', $response) ? $response['parameters'] : []; |
|
| 56 | + $message = array_key_exists('description', $response) ? $response[ 'description' ] : $exception->getMessage(); |
|
| 57 | + $parameters = array_key_exists('parameters', $response) ? $response[ 'parameters' ] : [ ]; |
|
| 58 | 58 | } else { |
| 59 | 59 | $message = $exception->getMessage(); |
| 60 | - $parameters = []; |
|
| 60 | + $parameters = [ ]; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | throw new HttpException($message, $exception->getCode(), $exception, $parameters); |