Conditions | 6 |
Paths | 10 |
Total Lines | 20 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | public static function recursive(array $array, int $level = 1): string |
||
29 | { |
||
30 | if ($level === 1) { |
||
31 | self::$value = ''; |
||
32 | } |
||
33 | |||
34 | foreach ($array as $key => $value) { |
||
35 | if (is_array($value)) { |
||
36 | self::$value .= str_repeat('-', $level - 1) . |
||
37 | (($level - 1 > 0) ? ' ' : '') . |
||
38 | $key . ':' . PHP_EOL; |
||
39 | self::recursive($value, $level + 1); |
||
40 | } else { |
||
41 | self::$value .= str_repeat('-', $level - 1) . |
||
42 | (($level - 1 > 0) ? ' ' : '') . |
||
43 | $key . ':' . $value . PHP_EOL; |
||
44 | } |
||
45 | } |
||
46 | |||
47 | return self::$value; |
||
48 | } |
||
50 |