Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3.0175 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | 1 | public function __construct ($code, $response) |
|
30 | { |
||
31 | 1 | $json = json_decode($response, true); |
|
32 | |||
33 | 1 | if (!is_null($json)) |
|
34 | { |
||
35 | 1 | $message = (isset($json["message"])) ? $json["message"] : $json["error"]; |
|
36 | |||
37 | 1 | $this->message = sprintf("HTTP %d: %s", $code, $message); |
|
38 | } |
||
39 | else |
||
40 | { |
||
41 | $this->message = $response; |
||
42 | } |
||
43 | |||
44 | 1 | $this->code = $code; |
|
45 | 1 | } |
|
46 | } |
||
47 |