1 | <?php |
||
7 | class Pipeline implements PipelineInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var callable[] |
||
11 | */ |
||
12 | private $stages = []; |
||
13 | |||
14 | /** |
||
15 | * @var ProcessorInterface |
||
16 | */ |
||
17 | private $processor; |
||
18 | |||
19 | /** |
||
20 | * Constructor. |
||
21 | * |
||
22 | * @param callable[] $stages |
||
23 | * @param ProcessorInterface $processor |
||
24 | * |
||
25 | * @throws InvalidArgumentException |
||
26 | */ |
||
27 | 18 | public function __construct(array $stages = [], ProcessorInterface $processor = null) |
|
38 | |||
39 | /** |
||
40 | * @inheritdoc |
||
41 | */ |
||
42 | 8 | public function pipe(callable $stage) |
|
49 | |||
50 | /** |
||
51 | * Process the payload. |
||
52 | * |
||
53 | * @param $payload |
||
54 | * |
||
55 | * @return mixed |
||
56 | */ |
||
57 | 10 | public function process($payload) |
|
61 | |||
62 | /** |
||
63 | * Fork the pipeline |
||
64 | * |
||
65 | 4 | * @param callable|null $resolver |
|
66 | * |
||
67 | 4 | * @return Fork |
|
68 | */ |
||
69 | public function fork(callable $resolver = null) |
||
74 | |||
75 | /** |
||
76 | * @inheritdoc |
||
77 | */ |
||
78 | public function __invoke($payload) |
||
82 | } |
||
83 |