| Conditions | 2 |
| Paths | 2 |
| Total Lines | 9 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 28 | public static function encode($value, int $options = 0, int $depth = 512): string |
||
| 29 | { |
||
| 30 | $encoded = json_encode($value, $options, $depth); |
||
| 31 | |||
| 32 | if (json_last_error() !== JSON_ERROR_NONE) { |
||
| 33 | throw new JsonException(sprintf('Unable to encode json. Error was: "%s".', json_last_error_msg())); |
||
| 34 | } |
||
| 35 | |||
| 36 | return (string)$encoded; |
||
| 37 | } |
||
| 57 |