Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | 7 | public static function flatten($array) |
|
32 | { |
||
33 | 7 | $newArray = []; |
|
34 | |||
35 | 7 | foreach ($array as $key => $value) { |
|
36 | 7 | if (is_array($value)) { |
|
37 | 7 | $newArray = array_merge($newArray, static::flatten($value)); |
|
38 | } else { |
||
39 | 7 | $newArray[$key] = $value; |
|
40 | } |
||
41 | } |
||
42 | |||
43 | 7 | return $newArray; |
|
44 | } |
||
46 |