addOption('disable-event-dispatcher', null, InputOption::VALUE_NONE, 'Whether disable event dispatcher.'); } public function disableDispatcher(InputInterface $input) { if (! $input->getOption('disable-event-dispatcher')) { if (! ApplicationContext::hasContainer()) { return; } $container = ApplicationContext::getContainer(); if (! $container->has(EventDispatcherInterface::class)) { return; } $dispatcher = $container->get(EventDispatcherInterface::class); $this->eventDispatcher = $dispatcher instanceof EventDispatcherInterface ? $dispatcher : null; } } }