| Total Complexity | 7 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | class Module |
||
| 19 | {
|
||
| 20 | /** |
||
| 21 | * @param ModuleManager $moduleManager |
||
| 22 | */ |
||
| 23 | public function init(ModuleManager $moduleManager): void |
||
| 24 | {
|
||
| 25 | $eventManager = $moduleManager->getEventManager()->getSharedManager(); |
||
| 26 | |||
| 27 | if (null === $eventManager) {
|
||
| 28 | return; |
||
| 29 | } |
||
| 30 | |||
| 31 | $eventManager->attach('doctrine', 'loadCli.post', [$this, 'addImportCommand']);
|
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param Event $event |
||
| 36 | */ |
||
| 37 | public function addImportCommand(Event $event): void |
||
| 38 | {
|
||
| 39 | /** @var Application $cliApplication */ |
||
| 40 | $cliApplication = $event->getTarget(); |
||
| 41 | |||
| 42 | $container = $event->getParam('ServiceManager', null);
|
||
| 43 | |||
| 44 | if ( |
||
| 45 | null === $container |
||
| 46 | || ! $container instanceof ContainerInterface |
||
| 47 | || ! $container->has(ImportCommand::class) |
||
| 48 | ) {
|
||
| 49 | return; |
||
| 50 | } |
||
| 51 | |||
| 52 | ConsoleRunner::addCommands($cliApplication); |
||
| 53 | |||
| 54 | $cliApplication->add($container->get(ImportCommand::class)); |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @return array |
||
| 59 | */ |
||
| 60 | public function getConfig(): array |
||
| 63 | } |
||
| 64 | } |
||
| 65 |