Total Complexity | 10 |
Total Lines | 66 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
15 | class DebugHelper |
||
16 | { |
||
17 | /** |
||
18 | * @param string $dump |
||
19 | * @return string |
||
20 | */ |
||
21 | public static function pre(string $dump): string |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * @param string $dump |
||
28 | * @return string |
||
29 | */ |
||
30 | public static function prettify(string $dump) |
||
31 | { |
||
32 | // @TODO highlight code |
||
33 | |||
34 | return self::pre($dump); |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * @param mixed $mixed |
||
39 | * @param bool $pretty |
||
40 | * @return string |
||
41 | */ |
||
42 | public static function print_r($mixed, bool $pretty = true): string |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @param mixed $expression |
||
52 | * @param bool $pretty |
||
53 | * @return string |
||
54 | */ |
||
55 | public static function export($expression, bool $pretty = true): string |
||
56 | { |
||
57 | $exported = var_export($expression, true) ?: $expression; |
||
58 | |||
59 | return $pretty ? self::prettify($exported) : |
||
|
|||
60 | $exported; |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * @param mixed $expression |
||
65 | * @param bool $pretty |
||
66 | * @return string |
||
67 | */ |
||
68 | public static function dump($expression, bool $pretty = true): string |
||
81 | } |
||
82 | } |