N98\Magento\Command\MagentoConnect\AbstractConnectCommand::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)
    {
        $found = false;
        $alternatives = array();
        $extensions = $this->callMageScript($input, $output, 'list-available');
        $searchPackage = $input->getArgument('package');
        foreach (preg_split('/' . PHP_EOL . '/', $extensions) as $line) {
            $matches = $this->matchConnectLine($line);
            if (!empty($matches)) {
                if ($matches[1] == $searchPackage) {
                    $found = true;
                    break 1;
                } else {
                    if ($this->isAlternative($matches[1], $searchPackage)) {
                        $alternatives[] = $matches[1];
                    }
                }
            }
        }
        if ($found) {
            $this->doAction($input, $output, $searchPackage);
        } else {
            $output->writeln('<comment>Could not find package.</comment>');
            if (count($alternatives) > 0) {
                $this->doAction($input, $output, $this->askForAlternativePackage($alternatives, $output));
            }
        }
    }