Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | 30 | public static function flatten(array $array, string $prefix = ''): array |
|
10 | { |
||
11 | 30 | $result = array(); |
|
12 | 30 | foreach ($array as $key => $value) { |
|
13 | 27 | if (is_array($value)) { |
|
14 | 24 | $result = $result + self::flatten($value, $prefix . $key . '.'); |
|
15 | } else { |
||
16 | 27 | $result[$prefix . $key] = $value; |
|
17 | } |
||
18 | } |
||
19 | 30 | return $result; |
|
20 | } |
||
22 |