N98\Magento\Command\Developer\Module\Observer\ListCommand::execute PHP Метод

execute() защищенный Метод

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output ) : integer | void
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
Результат integer | void
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->detectMagento($output, true);
        if (!$this->initMagento()) {
            return;
        }
        $type = $input->getArgument('type');
        $areas = array('global', 'adminhtml', 'frontend', 'crontab');
        if ($type === null) {
            $type = $this->askForArrayEntry($areas, $output, 'Please select an area:');
        }
        if (!in_array($type, $areas)) {
            throw new InvalidArgumentException('Invalid type! Use one of: ' . implode(', ', $areas));
        }
        if ($input->getOption('format') === null) {
            $this->writeSection($output, 'Observers: ' . $type);
        }
        $frontendEvents = \Mage::getConfig()->getNode($type . '/events')->asArray();
        if (true === $input->getOption('sort')) {
            // sorting for Observers is a bad idea because the order in which observers will be called is important.
            ksort($frontendEvents);
        }
        $table = array();
        foreach ($frontendEvents as $eventName => $eventData) {
            $observerList = array();
            foreach ($eventData['observers'] as $observer) {
                $observerList[] = $this->getObserver($observer, $type);
            }
            $table[] = array($eventName, implode("\n", $observerList));
        }
        $this->getHelper('table')->setHeaders(array('Event', 'Observers'))->setRows($table)->renderByFormat($output, $table, $input->getOption('format'));
    }