N98\Magento\Command\MagentoConnect\ListExtensionsCommand::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)
    {
        $extensions = $this->callMageScript($input, $output, 'list-available');
        if (!strstr($extensions, 'Please initialize Magento Connect installer')) {
            $searchString = $input->getArgument('search');
            $table = array();
            foreach (preg_split('/' . PHP_EOL . '/', $extensions) as $line) {
                if (strpos($line, ':') > 0) {
                    $matches = null;
                    if ($matches = $this->matchConnectLine($line)) {
                        if (!empty($searchString) && !stristr($line, $searchString)) {
                            continue;
                        }
                        $table[] = array($matches[1], $matches[2], $matches[3]);
                        if (isset($matches[4]) && isset($matches[5])) {
                            $table[] = array($matches[1], $matches[4], $matches[5]);
                        }
                        if (isset($matches[6]) && isset($matches[7])) {
                            $table[] = array($matches[1], $matches[6], $matches[7]);
                        }
                    }
                }
            }
            if (count($table) > 0) {
                $this->getHelper('table')->setHeaders(array('Package', 'Version', 'Stability'))->renderByFormat($output, $table, $input->getOption('format'));
            }
        } else {
            $output->writeln('<error>' . $extensions . '</error>');
        }
    }
ListExtensionsCommand