@@ -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']); |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | ->step([$this, 'nestedRailway']) |
| 19 | 19 | ->step([$this, 'castRequest'], ['name' => 'CastReq']) |
| 20 | 20 | ->step([$this, 'validateRequest']) |
| 21 | - ->step(function ($params) { |
|
| 21 | + ->step(function($params) { |
|
| 22 | 22 | return error($params, 'AAA!!!'); |
| 23 | 23 | }, ['failFast' => true]) |
| 24 | 24 | ->step([$this, 'findUser']) |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | ->tryCatch([$this, 'sendNotification']) |
| 28 | 28 | ->always([$this, 'writeLog']) |
| 29 | 29 | ->failure([$this, 'notifyAdmin'], ['name' => 'Last']) |
| 30 | - ->step(function ($params) { |
|
| 30 | + ->step(function($params) { |
|
| 31 | 31 | return ok($params, ['a' => 'b']); |
| 32 | 32 | }, ['after' => 'First', 'name' => 'FinalCheck']); |
| 33 | 33 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | public function nestedRailway($params) |
| 46 | 46 | { |
| 47 | 47 | return (new Railway) |
| 48 | - ->step(function ($params) { |
|
| 48 | + ->step(function($params) { |
|
| 49 | 49 | //return error($params, 'Nested Railway failed!'); |
| 50 | 50 | return ok($params, ['nestedRwParam' => 'nestedRwValue']); |
| 51 | 51 | }) |
@@ -153,12 +153,12 @@ |
||
| 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 | $failFast = $opt['failFast'] ?? null; |
| 160 | 160 | if($failFast && $track == self::TRACK_FAILURE) { |
| 161 | - break; |
|
| 161 | + break; |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | 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; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $track = $this->performStep($step, $params, $opt, $track); |
| 158 | 158 | |
| 159 | 159 | $failFast = $opt['failFast'] ?? null; |
| 160 | - if($failFast && $track == self::TRACK_FAILURE) { |
|
| 160 | + if ($failFast && $track == self::TRACK_FAILURE) { |
|
| 161 | 161 | break; |
| 162 | 162 | } |
| 163 | 163 | } |