Conditions | 3 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | public function jsonEncode(mixed $data): string |
||
24 | { |
||
25 | $options = 0; |
||
26 | if (empty($data)) { |
||
27 | $options = JSON_FORCE_OBJECT; |
||
28 | } |
||
29 | |||
30 | $response = json_encode($data, $options); |
||
31 | |||
32 | if ($response === false) { |
||
33 | throw new ArangoException('JSON encoding failed with error: ' . json_last_error_msg(), json_last_error()); |
||
34 | } |
||
35 | |||
36 | return $response; |
||
37 | } |
||
65 |