N98\Magento\Command\System\InfoCommand::execute PHP Method

execute() protected method

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
return integer | void
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->detectMagento($output);
        $softInitMode = in_array($input->getArgument('key'), array('version', 'edition'));
        if ($input->getOption('format') == null && $input->getArgument('key') == null) {
            $this->writeSection($output, 'Magento System Information');
        }
        $this->initMagento($softInitMode);
        $this->infos['Version'] = \Mage::getVersion();
        $this->infos['Edition'] = $this->_magentoEnterprise ? 'Enterprise' : 'Community';
        if ($softInitMode === false) {
            $config = \Mage::app()->getConfig();
            $this->addCacheInfos();
            $this->infos['Session'] = $config->getNode('global/session_save');
            $this->infos['Crypt Key'] = $config->getNode('global/crypt/key');
            $this->infos['Install Date'] = $config->getNode('global/install/date');
            try {
                $this->findCoreOverwrites();
                $this->findVendors();
                $this->attributeCount();
                $this->customerCount();
                $this->categoryCount();
                $this->productCount();
            } catch (Exception $e) {
                $output->writeln('<error>' . $e->getMessage() . '</error>');
            }
        }
        $table = array();
        foreach ($this->infos as $key => $value) {
            $table[] = array($key, $value);
        }
        if (($settingArgument = $input->getArgument('key')) !== null) {
            $settingArgument = strtolower($settingArgument);
            $this->infos = array_change_key_case($this->infos, CASE_LOWER);
            if (!isset($this->infos[$settingArgument])) {
                throw new InvalidArgumentException('Unknown key: ' . $settingArgument);
            }
            $output->writeln((string) $this->infos[$settingArgument]);
        } else {
            $this->getHelper('table')->setHeaders(array('name', 'value'))->renderByFormat($output, $table, $input->getOption('format'));
        }
    }