Total Complexity | 3 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | class RequestException extends \Exception |
||
13 | { |
||
14 | protected $responseCode; |
||
15 | |||
16 | protected $message; |
||
17 | |||
18 | protected $type; |
||
19 | |||
20 | /** |
||
21 | * Request exception constructor |
||
22 | * |
||
23 | * @param string $response json_decoded array with the error response given by the server |
||
24 | */ |
||
25 | public function __construct($response) |
||
26 | { |
||
27 | $error = $response['error']; |
||
28 | $this->responseCode = $error['code']; |
||
29 | $this->message = $error['message']; |
||
30 | $this->type = $error['type']; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * Returns responseCode |
||
35 | * |
||
36 | * @return mixed |
||
37 | */ |
||
38 | public function getResponseCode() |
||
39 | { |
||
40 | return $this->responseCode; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Returns type |
||
45 | * |
||
46 | * @return mixed |
||
47 | */ |
||
48 | public function getType() |
||
51 | } |
||
52 | } |
||
53 |