Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
29 | public function decode(string $json): array |
||
30 | { |
||
31 | $result = json_decode($json, true); |
||
32 | |||
33 | if (json_last_error() !== JSON_ERROR_NONE) { |
||
34 | throw new JsonDecodingException(json_last_error_msg(), json_last_error()); |
||
35 | } |
||
36 | |||
37 | if (!is_array($result)) { |
||
38 | throw new JsonDecodingException('Claims are not in array format.'); |
||
39 | } |
||
40 | |||
41 | return $result; |
||
42 | } |
||
44 |