| Total Complexity | 4 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | trait LazyTrait |
||
| 20 | { |
||
| 21 | /** @var ContainerInterface */ |
||
| 22 | private $container; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Check if command can be lazy-loaded. |
||
| 26 | * |
||
| 27 | * @param class-string $class |
||
|
|
|||
| 28 | * @return bool |
||
| 29 | */ |
||
| 30 | private function supportsLazyLoading(string $class): bool |
||
| 31 | { |
||
| 32 | return is_subclass_of($class, SpiralCommand::class) |
||
| 33 | && \defined(sprintf('%s::%s', $class, 'NAME')); |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Wrap given command into LazyCommand which will be executed only on run. |
||
| 38 | * |
||
| 39 | * @param class-string $class |
||
| 40 | * @return LazyCommand |
||
| 41 | */ |
||
| 42 | private function createLazyCommand(string $class): LazyCommand |
||
| 56 | } |
||
| 57 | ); |
||
| 60 |