Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
26 | public static function from_php($var, $options = 0, $depth = 512): string |
||
27 | { |
||
28 | // https://www.php.net/manual/en/function.json-encode.php |
||
29 | $ret = json_encode($var, $options, $depth); |
||
30 | |||
31 | $error = self::hasErrors(); |
||
32 | if ($error !== false) { |
||
33 | throw new \Exception("ParsingException: $error"); |
||
34 | } |
||
35 | |||
36 | return $ret; |
||
37 | } |
||
47 |