Conditions | 2 |
Paths | 2 |
Total Lines | 8 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 2.032 |
Changes | 0 |
1 | <?php |
||
36 | 6 | private function getDecodedJson(string $string): array |
|
37 | { |
||
38 | 6 | $decodedJson = json_decode($string, true); |
|
39 | 6 | if (json_last_error() !== \JSON_ERROR_NONE) { |
|
40 | throw new \InvalidArgumentException(sprintf('Invalid json: %s. Parsing error: %s', $string, json_last_error_msg())); |
||
41 | } |
||
42 | |||
43 | 6 | return $decodedJson; |
|
44 | } |
||
46 |