| Conditions | 8 |
| Paths | 5 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 8 |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | 14 | public function cast($value) |
|
| 12 | { |
||
| 13 | 14 | if ($value === null || (is_array($value) && count($value) === 0)) { |
|
| 14 | 1 | return ''; |
|
| 15 | } |
||
| 16 | 13 | if ($value === true) return 'true'; |
|
| 17 | 12 | if ($value === false) return 'false'; |
|
| 18 | 11 | if (is_array($value) || is_object($value)) { |
|
| 19 | 1 | return json_encode($value); |
|
| 20 | } |
||
| 21 | 10 | return (string) $value; |
|
| 22 | } |
||
| 23 | } |
||
| 24 |