Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
21 | public static function flatMap(array $array, callable $callback): array |
||
22 | { |
||
23 | $mapped = static::map($array, $callback); |
||
24 | |||
25 | $flattened = []; |
||
26 | |||
27 | foreach ($mapped as $item) { |
||
28 | if (is_array($item)) { |
||
29 | $flattened = array_merge($flattened, $item); |
||
30 | } else { |
||
31 | $flattened[] = $item; |
||
32 | } |
||
33 | } |
||
34 | |||
35 | return $flattened; |
||
36 | } |
||
37 | |||
65 |