Conditions | 6 |
Paths | 6 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | public static function stringify(mixed $value, bool $unwrap = true): string |
||
11 | { |
||
12 | $type = gettype($value); |
||
13 | if (!$unwrap) { |
||
14 | return $type; |
||
15 | } |
||
16 | if (is_scalar($value)) { |
||
17 | if (is_bool($value)) { |
||
18 | $value = $value ? 'true' : 'false'; |
||
19 | } |
||
20 | return sprintf('%s(%s)', $type, $value); |
||
21 | } |
||
22 | if (is_object($value)) { |
||
23 | return sprintf('%s(%s)', $type, get_class($value)); |
||
24 | } |
||
25 | return $type; |
||
26 | } |
||
27 | } |