| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | function compose(array $funcs, $multi = false) { |
||
| 32 | if (!$multi) { |
||
| 33 | return function($arg) use ($funcs) { |
||
| 34 | return array_reduce($funcs, function($acc, $func) { |
||
| 35 | return $func($acc); |
||
| 36 | }, $arg); |
||
| 37 | }; |
||
| 38 | } |
||
| 39 | |||
| 40 | return function(...$args) use ($funcs) { |
||
| 41 | return array_reduce($funcs, function($acc, $func) { |
||
| 42 | return $func(...$acc); |
||
| 43 | }, $args); |
||
| 44 | }; |
||
| 45 | } |
||
| 46 | |||
| 56 | } |