Conditions | 4 |
Paths | 5 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
39 | private function getCallable($pipes, $outlet) |
||
40 | { |
||
41 | if ($this->callable !== null) { |
||
42 | return $this->callable; |
||
43 | } |
||
44 | |||
45 | if ($outlet !== null) { |
||
46 | $callable = $outlet; |
||
47 | } else { |
||
48 | $callable = function ($payload) { |
||
49 | return $payload; |
||
50 | }; |
||
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 |