Conditions | 5 |
Paths | 16 |
Total Lines | 23 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
44 | public function __construct(ResponseInterface $response) |
||
45 | { |
||
46 | $this->httpCode = $response->getStatusCode(); |
||
47 | |||
48 | $body = json_decode($response->getBody(), true); |
||
49 | |||
50 | if (isset($body['error'])) { |
||
51 | $this->message = $body['error']; |
||
52 | } |
||
53 | |||
54 | if (isset($body['error_description'])) { |
||
55 | $this->message = $body['error_description']; |
||
56 | } |
||
57 | |||
58 | if (isset($body['message']['value'])) { |
||
59 | $this->message = $body['message']['value']; |
||
60 | } |
||
61 | |||
62 | if (isset($body['code'])) { |
||
63 | $this->code = $body['code']; |
||
64 | } |
||
65 | |||
66 | parent::__construct('['.$this->code.'] '.$this->message, $this->httpCode); |
||
67 | } |
||
69 |