Conditions | 4 |
Paths | 5 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public static function arrayFlatten(array $translations, string $prefix = ''): array |
||
16 | { |
||
17 | $result = array(); |
||
18 | |||
19 | foreach ($translations as $key => $value) { |
||
20 | $new_key = $prefix . (empty($prefix) ? '' : '.') . $key; |
||
21 | |||
22 | if (is_array($value)) { |
||
23 | $result = array_merge_recursive($result, self::arrayFlatten($value, $new_key)); |
||
24 | } else { |
||
25 | $result[$new_key] = $value; |
||
26 | } |
||
27 | } |
||
28 | |||
29 | return $result; |
||
30 | } |
||
60 |