| Conditions | 5 |
| Paths | 5 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | public function coerce($value) |
||
| 13 | { |
||
| 14 | if ($value === null) { |
||
| 15 | return 'null'; |
||
| 16 | } |
||
| 17 | |||
| 18 | if ($value === true) { |
||
| 19 | return 'true'; |
||
| 20 | } |
||
| 21 | |||
| 22 | if ($value === false) { |
||
| 23 | return 'false'; |
||
| 24 | } |
||
| 25 | |||
| 26 | if (!\is_scalar($value)) { |
||
| 27 | throw new InvalidTypeException('String cannot represent a non-scalar value'); |
||
| 28 | } |
||
| 29 | |||
| 30 | return (string)$value; |
||
| 31 | } |
||
| 33 |