| @@ 60-68 (lines=9) @@ | ||
| 57 | if ($action instanceof \Closure) { |
|
| 58 | // Lazy loading |
|
| 59 | $action = $this->actions[$manager][$stepName](); |
|
| 60 | if (!$action instanceof StepActionInterface) { |
|
| 61 | throw new \RuntimeException(\sprintf( |
|
| 62 | "Lazy-loaded action \"%s\" for character manager \"%s\" must be resolved to an instance of \"%s\".\n\"%s\" given.", |
|
| 63 | $stepName, |
|
| 64 | $manager, |
|
| 65 | StepActionInterface::class, |
|
| 66 | \is_object($action) ? \get_class($action) : \gettype($action) |
|
| 67 | )); |
|
| 68 | } |
|
| 69 | $this->actions[$manager][$stepName] = $action; |
|
| 70 | } |
|
| 71 | ||
| @@ 247-253 (lines=7) @@ | ||
| 244 | private function setSteps(array $steps): void |
|
| 245 | { |
|
| 246 | foreach ($steps as $step) { |
|
| 247 | if (!$step instanceof StepInterface) { |
|
| 248 | throw new \InvalidArgumentException(\sprintf( |
|
| 249 | 'Expected %s instance, "%s" given.', |
|
| 250 | StepActionInterface::class, |
|
| 251 | \is_object($step) ? \get_class($step) : \gettype($step) |
|
| 252 | )); |
|
| 253 | } |
|
| 254 | } |
|
| 255 | ||
| 256 | $this->steps = $steps; |
|