| Conditions | 3 |
| Paths | 3 |
| Total Lines | 9 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 1 | public static function toJSON($object): string { |
|
| 22 | 1 | if (\is_object($object)) { |
|
| 23 | 1 | if (\method_exists($object, 'toArray')) { |
|
| 24 | 1 | $object = $object->toArray(); |
|
| 25 | } else { |
||
| 26 | 1 | $object = (array) $object; |
|
| 27 | } |
||
| 28 | } |
||
| 29 | 1 | return \json_encode($object, \JSON_PRETTY_PRINT | \JSON_NUMERIC_CHECK); |
|
| 30 | } |
||
| 68 |