Conditions | 6 |
Paths | 5 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 16 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | 99 | public static function merge(array $arrays) |
|
19 | { |
||
20 | 99 | $result = []; |
|
21 | 99 | foreach ($arrays as $array) { |
|
22 | 99 | foreach ($array as $key => $value) { |
|
23 | 99 | if (is_int($key)) { |
|
24 | 3 | $result[] = $value; |
|
25 | 3 | continue; |
|
26 | } |
||
27 | |||
28 | 96 | if (isset($result[$key]) && is_array($result[$key])) { |
|
29 | 1 | $result[$key] = self::merge( |
|
30 | 1 | [$result[$key], $value] |
|
31 | 1 | ); |
|
32 | 1 | continue; |
|
33 | } |
||
34 | |||
35 | 96 | $result[$key] = $value; |
|
36 | 99 | } |
|
37 | 99 | } |
|
38 | |||
39 | 99 | return $result; |
|
40 | } |
||
42 |