Total Complexity | 1 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | class JsonEncoder extends BaseJsonEncoder |
||
12 | { |
||
13 | |||
14 | /** |
||
15 | * @var array unwanted JSON Unicode characters and their replacements |
||
16 | */ |
||
17 | private static $unwantedJsonUnicodeCharacters = [ |
||
18 | "\\u2028" => '', |
||
19 | "\\u2029" => '', |
||
20 | ]; |
||
21 | |||
22 | /** |
||
23 | * Encodes JSON with some additional filtering and sanitization. In contrast to just using json_encode(), this |
||
24 | * method throws an exception if encoding fails. |
||
25 | * |
||
26 | * @param mixed $data the data to encode |
||
27 | * @param int $options |
||
28 | * @param int $depth |
||
29 | * |
||
30 | * @return string the encoded JSON |
||
31 | * |
||
32 | */ |
||
33 | public static function encode($data, int $options = 0, int $depth = 512): string |
||
43 |