Conditions | 4 |
Paths | 5 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public static function flatten(array $config, string $prefix = '') : array { |
||
19 | $result = []; |
||
20 | |||
21 | foreach ($config as $key => $value) { |
||
22 | $new_key = $prefix . (empty($prefix) ? '' : '.') . $key; |
||
23 | |||
24 | if (is_array($value)) { |
||
25 | $result = array_merge($result, self::flatten($value, $new_key)); |
||
26 | } else { |
||
27 | $result[$new_key] = $value; |
||
28 | } |
||
29 | } |
||
30 | |||
31 | return $result; |
||
32 | } |
||
33 | } |
||
34 |