1 | <?php |
||
15 | class Railway |
||
16 | { |
||
17 | const TRACK_SUCCESS = 'success_track'; |
||
18 | const TRACK_FAILURE = 'failure_track'; |
||
19 | |||
20 | /** |
||
21 | * @var \SplQueue |
||
22 | */ |
||
23 | protected $stepsQueue; |
||
24 | |||
25 | 1 | public function __construct() |
|
26 | { |
||
27 | 1 | $this->stepsQueue = new \SplQueue(); |
|
28 | 1 | } |
|
29 | |||
30 | /** |
||
31 | * |
||
32 | * @param AbstractStep $stepObject |
||
33 | * @param array $opt |
||
34 | * @return $this |
||
35 | */ |
||
36 | 1 | public function rawStep(AbstractStep $stepObject, $opt = []) : Railway |
|
|
|||
37 | { |
||
38 | 1 | $this->stepsQueue->enqueue($stepObject); |
|
39 | 1 | return $this; |
|
40 | } |
||
41 | |||
42 | 1 | public function step(callable $callable, $opt = []) : Railway |
|
43 | { |
||
44 | 1 | $name = $opt['name'] ?? null; |
|
45 | 1 | return $this->rawStep(new Step($callable, $name), $opt); |
|
46 | } |
||
47 | |||
48 | public function always(callable $callable, $opt = []) : Railway |
||
53 | |||
54 | public function failure(callable $callable, $opt = []) : Railway |
||
59 | |||
60 | public function tryCatch(callable $callable, $opt = []) : Railway |
||
65 | |||
66 | /** |
||
67 | * @param $params |
||
68 | * @return Result |
||
69 | * @throws \Exception |
||
70 | */ |
||
71 | 1 | public function runWithParams($params) |
|
84 | |||
85 | /** |
||
86 | * @param $params |
||
87 | * @param $step |
||
88 | * @return string |
||
89 | * @throws \Exception |
||
90 | */ |
||
91 | 1 | protected function performStep($step, &$params, $track, &$signaturesPipeline) |
|
121 | |||
122 | 1 | protected function getStepClassName(AbstractStep $step) : string |
|
127 | } |
||
128 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.