Total Complexity | 6 |
Total Lines | 74 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | final class Pipe |
||
13 | { |
||
14 | /** |
||
15 | * The callback processor |
||
16 | * |
||
17 | * @var ProcessorInterface |
||
18 | */ |
||
19 | private $processor; |
||
20 | |||
21 | /** |
||
22 | * The pipe callback |
||
23 | * |
||
24 | * @var callable |
||
25 | */ |
||
26 | private $callback; |
||
27 | |||
28 | /** |
||
29 | * The pipe chain |
||
30 | * |
||
31 | * @var callable |
||
32 | */ |
||
33 | private $next; |
||
34 | |||
35 | /** |
||
36 | * PipeInterface constructor |
||
37 | * |
||
38 | * @param ProcessorInterface $processor |
||
39 | * @param callable $callback |
||
40 | */ |
||
41 | public function __construct(ProcessorInterface $processor, callable $callback) |
||
42 | { |
||
43 | $this->processor = $processor; |
||
44 | $this->callback = $callback; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Set the next pipe |
||
49 | * |
||
50 | * @param callable $pipe |
||
51 | */ |
||
52 | public function setNext(callable $pipe) |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Get the next pipe |
||
59 | * |
||
60 | * @return callable |
||
61 | */ |
||
62 | public function getNext() |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Invoke pipe |
||
69 | * |
||
70 | * @param array $payload |
||
71 | * |
||
72 | * @return mixed |
||
73 | */ |
||
74 | public function __invoke(...$payload) |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * Clone the pipe |
||
81 | */ |
||
82 | public function __clone() |
||
89 |