Total Complexity | 4 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 38.46% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
12 | class Helper |
||
13 | { |
||
14 | /** |
||
15 | * Returns PHP-executable string representation of given value. |
||
16 | * Uses Riimu/Kit-PHPEncoder based `var_export` alternative. |
||
17 | * And Opis/Closure to dump closures as PHP code. |
||
18 | * @param mixed $value |
||
19 | * @return string |
||
20 | * @throws \ReflectionException |
||
21 | */ |
||
22 | 11 | public static function exportVar($value): string |
|
23 | { |
||
24 | 11 | return static::getEncoder()->encode($value); |
|
25 | } |
||
26 | |||
27 | private static ?PHPEncoder $encoder = null; |
||
28 | |||
29 | 11 | private static function getEncoder(): PHPEncoder |
|
36 | } |
||
37 | |||
38 | private static function createEncoder(): PHPEncoder |
||
50 |