Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | public static function decode($string): array |
||
28 | { |
||
29 | if (! is_string($string)) { |
||
30 | throw new JsonException('Json decode parameter must be a string'); |
||
31 | } |
||
32 | |||
33 | $array = json_decode($string, true); |
||
34 | |||
35 | if ($array !== null) { |
||
36 | $error = error_get_last(); |
||
37 | throw new JsonException($error['message']); |
||
38 | } |
||
39 | return $array; |
||
40 | } |
||
42 |