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