| 1 | <?php |
||
| 6 | class Fork implements ForkInterface |
||
| 7 | { |
||
| 8 | /** |
||
| 9 | * @var Pipeline |
||
| 10 | */ |
||
| 11 | private $parent; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var array callable |
||
| 15 | */ |
||
| 16 | protected $forks = []; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var callable |
||
| 20 | */ |
||
| 21 | protected $resolver; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Fork constructor. |
||
| 25 | * @param callable|null $resolver |
||
| 26 | * @param array $forks |
||
| 27 | */ |
||
| 28 | public function __construct(callable $resolver = null, $forks = []) |
||
| 33 | |||
| 34 | public function pipeline(Pipeline $pipeline) |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @inheritdoc |
||
| 41 | */ |
||
| 42 | public function join(callable $resolver = null) |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @inheritdoc |
||
| 54 | */ |
||
| 55 | public function disjoin(string $tag, callable $stage = null) |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Chooses a fork or short-circuits based on $resolver |
||
| 70 | * |
||
| 71 | * @param mixed $payload |
||
| 72 | * @return mixed |
||
| 73 | */ |
||
| 74 | public function __invoke($payload) |
||
| 82 | } |
||
| 83 |