| Conditions | 2 |
| Paths | 1 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 18 |
| Ratio | 100 % |
| Tests | 8 |
| CRAP Score | 2 |
| 1 | <?php |
||
| 10 | View Code Duplication | function flatten() |
|
| 11 | { |
||
| 12 | 1 | $args = func_get_args(); |
|
| 13 | |||
| 14 | $flatten = function (array $ls) { |
||
| 15 | return array_reduce($ls, function ($carry, $curr) { |
||
| 16 | 1 | if (is_array($curr)) { |
|
| 17 | 1 | return array_merge($carry, flatten($curr)); |
|
| 18 | } |
||
| 19 | |||
| 20 | 1 | $carry[] = $curr; |
|
| 21 | |||
| 22 | 1 | return $carry; |
|
| 23 | 1 | }, []); |
|
| 24 | 1 | }; |
|
| 25 | |||
| 26 | 1 | return call_user_func_array(curry($flatten), $args); |
|
| 27 | } |
||
| 28 |