Total Complexity | 2 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | final class Functions |
||
6 | { |
||
7 | |||
8 | 3 | public static final function strval($value): string |
|
|
|||
9 | { |
||
10 | 3 | if (is_double($value)) { |
|
11 | 2 | $str = \strval($value); |
|
12 | 2 | if (strlen($str) == 1) { |
|
13 | 1 | return sprintf("%1\$.1f",$value); |
|
14 | } |
||
15 | 2 | return \strval($value); |
|
16 | } |
||
17 | 2 | if (is_bool($value)) { |
|
18 | 1 | return $value ? "true" : "false"; |
|
19 | } |
||
20 | 2 | return "$value"; |
|
21 | } |
||
22 | |||
23 | public static final function emptyList(): ListInterface |
||
24 | { |
||
25 | return new class() implements ListInterface { |
||
26 | private $array = []; |
||
27 | use ArrayListTrait; |
||
28 | }; |
||
29 | } |
||
30 | |||
31 | 16 | public static final function listOf(...$elements): ListInterface |
|
36 | } |
||
37 | } |
||
38 | |||
39 | function strval($value): string |
||
40 | { |
||
58 |