| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4.0218 |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | 1 | public static function flatArrayRecursive(?array $array): array |
|
| 10 | { |
||
| 11 | 1 | if (empty($array)) { |
|
| 12 | return []; |
||
| 13 | } |
||
| 14 | |||
| 15 | 1 | $resultArray = []; |
|
| 16 | |||
| 17 | 1 | foreach ($array as $key => $value) { |
|
| 18 | 1 | if (is_array($value)) { |
|
| 19 | 1 | $resultArray = array_merge($resultArray, static::flatArrayRecursive($value)); |
|
| 20 | } else { |
||
| 21 | 1 | $resultArray[] = $value; |
|
| 22 | } |
||
| 23 | } |
||
| 24 | |||
| 25 | 1 | return $resultArray; |
|
| 26 | } |
||
| 27 | } |
||
| 28 |