1 | <?php |
||
26 | class Pipeline extends AbstractObject implements PipelineInterface |
||
27 | { |
||
28 | /** |
||
29 | * @var StageInterface[]|callable[] |
||
30 | */ |
||
31 | protected $stages = []; |
||
32 | |||
33 | /** |
||
34 | * @var ProcessorInterface|null |
||
35 | */ |
||
36 | protected $processor = FingersCrossedProcessor::class; |
||
37 | |||
38 | /** |
||
39 | * @inheritdoc |
||
40 | */ |
||
41 | public function __construct($config = []) |
||
46 | |||
47 | /** |
||
48 | * @return callable[]|StageInterface[]|mixed|null |
||
49 | */ |
||
50 | protected function getStages() |
||
58 | |||
59 | /** |
||
60 | * @param $stage |
||
61 | * @return callable |
||
62 | * @throws InvalidArgumentException |
||
63 | */ |
||
64 | protected function resolveStage($stage): callable |
||
82 | |||
83 | /** |
||
84 | * @return ProcessorInterface |
||
85 | * @throws InvalidArgumentException |
||
86 | */ |
||
87 | public function getProcessor(): ProcessorInterface |
||
95 | |||
96 | /** |
||
97 | * @param $processor |
||
98 | * @return $this |
||
99 | */ |
||
100 | public function setProcessor($processor) |
||
105 | |||
106 | /** |
||
107 | * @param $processor |
||
108 | * @return ProcessorInterface |
||
109 | * @throws InvalidArgumentException |
||
110 | */ |
||
111 | protected function resolveProcessor($processor): ProcessorInterface |
||
132 | |||
133 | /** |
||
134 | * @inheritdoc |
||
135 | */ |
||
136 | public function pipe(callable $stage) |
||
143 | |||
144 | /** |
||
145 | * @param $payload |
||
146 | * @return mixed |
||
147 | * @throws InvalidArgumentException |
||
148 | */ |
||
149 | public function process($payload) |
||
153 | |||
154 | /** |
||
155 | * @inheritdoc |
||
156 | */ |
||
157 | public function __invoke($payload) |
||
161 | } |
||
162 |