Conditions | 3 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
43 | private function buildCallable($pipes, $outlet) |
||
44 | { |
||
45 | $callable = function (...$payload) use($outlet) { |
||
46 | if ($outlet !== null) { |
||
47 | return $outlet(...$payload); |
||
48 | } |
||
49 | |||
50 | return $payload[0] ?? null; |
||
51 | }; |
||
52 | |||
53 | while ($pipe = array_pop($pipes)) { |
||
54 | $callable = function (...$payload) use ($pipe, $callable) { |
||
55 | return $pipe($callable, ...$payload); |
||
56 | }; |
||
57 | } |
||
58 | |||
59 | return $callable; |
||
60 | } |
||
70 |