Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
47 | 5 | private function decodeJson(bool $asArray = false) |
|
48 | { |
||
49 | 5 | $content = json_decode($this->get(), $asArray); |
|
50 | 5 | if (json_last_error() !== JSON_ERROR_NONE) { |
|
51 | 4 | throw new ContentException( |
|
52 | 4 | sprintf("Could not decode content, got %s", json_last_error_msg()) |
|
53 | ); |
||
54 | } |
||
55 | 1 | return $content; |
|
56 | } |
||
57 | } |
||
58 |