Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | public static function isJson($value): bool |
||
17 | { |
||
18 | if (! is_string($value)) { |
||
19 | return false; |
||
20 | } |
||
21 | |||
22 | if (function_exists('json_validate')) { |
||
23 | return json_validate($value, 512); |
||
24 | } |
||
25 | |||
26 | try { |
||
27 | Utils::jsonDecode($value, true, 512, 4194304); |
||
28 | } catch (\JsonException) { |
||
29 | return false; |
||
30 | } |
||
31 | |||
32 | return true; |
||
33 | } |
||
34 | } |