| Conditions | 6 |
| Paths | 6 |
| Total Lines | 23 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | public function format($target) |
||
| 13 | { |
||
| 14 | if (is_null($target)) { |
||
| 15 | return '(null)'; |
||
| 16 | } elseif (is_array($target)) { |
||
| 17 | return '(Array) {...}'; |
||
| 18 | } elseif (is_scalar($target)) { |
||
| 19 | $type = gettype($target); |
||
| 20 | |||
| 21 | if (is_bool($target)) { |
||
| 22 | $value = $target ? 'true' : 'false'; |
||
| 23 | } else { |
||
| 24 | $value = (string) $target; |
||
| 25 | } |
||
| 26 | |||
| 27 | return strtr('(:type) :value', [ |
||
| 28 | ':type' => $type, |
||
| 29 | ':value' => $value, |
||
| 30 | ]); |
||
| 31 | } else { |
||
| 32 | return strtr('(:class) {...}', [':class' => get_class($target)]); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 46 | } |