Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
10 | public static function to_php(string $string, ?bool $assoc = false, int $depth = 512, int $options = 0) |
||
11 | { |
||
12 | // https://www.php.net/manual/en/function.json-decode.php |
||
13 | $ret = json_decode($string, $assoc, $depth, $options); |
||
14 | |||
15 | $error = self::hasErrors(); |
||
16 | if ($error !== false) { |
||
|
|||
17 | throw new \Exception("ParsingException: $error"); |
||
18 | } |
||
19 | |||
20 | return $ret; |
||
21 | } |
||
47 |