Conditions | 3 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function createCallable(array $pipes, callable $outlet = null) |
||
18 | { |
||
19 | if ($outlet !== null) { |
||
20 | $callable = $outlet; |
||
21 | } else { |
||
22 | $callable = function ($payload) { |
||
23 | return $payload; |
||
24 | }; |
||
25 | }; |
||
26 | |||
27 | while ($pipe = array_pop($pipes)) { |
||
28 | $callable = function (...$payload) use ($pipe, $callable) { |
||
29 | return $pipe($callable, ...$payload); |
||
30 | }; |
||
31 | } |
||
32 | |||
33 | return $callable; |
||
34 | } |
||
36 |