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