@@ -33,6 +33,9 @@ discard block |
||
33 | 33 | $this->stepsQueue = []; |
34 | 34 | } |
35 | 35 | |
36 | + /** |
|
37 | + * @param string $stepName |
|
38 | + */ |
|
36 | 39 | protected function findTargetStepIndex($stepName) |
37 | 40 | { |
38 | 41 | $steps = array_column($this->stepsQueue, 'step'); |
@@ -161,6 +164,7 @@ discard block |
||
161 | 164 | |
162 | 165 | /** |
163 | 166 | * @throws \Exception |
167 | + * @param AbstractStep $step |
|
164 | 168 | */ |
165 | 169 | protected function performStep($step, &$params, $opt, $track) |
166 | 170 | { |
@@ -153,7 +153,7 @@ |
||
153 | 153 | $opt = $item['opt']; |
154 | 154 | /** |
155 | 155 | * @var $step AbstractStep |
156 | - */ |
|
156 | + */ |
|
157 | 157 | $track = $this->performStep($step, $params, $opt, $track); |
158 | 158 | } |
159 | 159 | return new Result($params, $track, $this->signaturesPipeline); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | protected function findTargetStepIndex($stepName) |
37 | 37 | { |
38 | 38 | $steps = array_column($this->stepsQueue, 'step'); |
39 | - $names = array_map(function ($step) { |
|
39 | + $names = array_map(function($step) { |
|
40 | 40 | return $step->name(); |
41 | 41 | }, $steps); |
42 | 42 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | return $this->rawStep(new TryCatch($callable, $name), $opt); |
132 | 132 | } |
133 | 133 | |
134 | - public function removeStep(string $stepName){ |
|
134 | + public function removeStep(string $stepName) { |
|
135 | 135 | $targetIndex = $this->findTargetStepIndex($stepName); |
136 | 136 | unset($this->stepsQueue[$targetIndex]); |
137 | 137 | return $this; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | public function railway() : Railway |
11 | 11 | { |
12 | 12 | return (new Railway) |
13 | - ->step(function ($params) { |
|
13 | + ->step(function($params) { |
|
14 | 14 | echo "Hey {$params['name']}. Say hello to anonymous function!"; |
15 | 15 | //return error($params, 'Early fail'); |
16 | 16 | return ok($params, ['newParam' => 'newValue']); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | ->tryCatch([$this, 'sendNotification']) |
25 | 25 | ->always([$this, 'writeLog']) |
26 | 26 | ->failure([$this, 'notifyAdmin'], ['name' => 'Last']) |
27 | - ->step(function ($params) { |
|
27 | + ->step(function($params) { |
|
28 | 28 | return ok($params, ['a' => 'b']); |
29 | 29 | }, ['after' => 'First', 'name' => 'FinalCheck']); |
30 | 30 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function nestedRailway($params) |
43 | 43 | { |
44 | 44 | return (new Railway) |
45 | - ->step(function ($params) { |
|
45 | + ->step(function($params) { |
|
46 | 46 | //return error($params, 'Nested Railway failed!'); |
47 | 47 | return ok($params, ['nestedRwParam' => 'nestedRwValue']); |
48 | 48 | }) |