Back to ExtensionInstallCommand class

Method doExecute

protected int
doExecute
(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output)
Internal function to execute the command.
Parameters
  • \Symfony\Component\Console\Input\InputInterface $input The input to inject into the command.
  • \Symfony\Component\Console\Output\OutputInterface $output The output to inject into the command.
Returns
  • int The command exit code
Since
  • 4.0.0
-
  • \Exception

Method doExecute - Source code

/**
 * Internal function to execute the command.
 *
 * @param   InputInterface   $input   The input to inject into the command.
 * @param   OutputInterface  $output  The output to inject into the command.
 *
 * @return  integer  The command exit code
 *
 * @throws \Exception
 * @since   4.0.0
 */
protected function doExecute(InputInterface $input, OutputInterface $output) : int
{
    $this->configureIO($input, $output);
    if ($path = $this->cliInput->getOption('path')) {
        $result = $this->processPathInstallation($path);
        if (!$result) {
            $this->ioStyle->error('Unable to install extension');
            return self::INSTALLATION_FAILED;
        }
        $this->ioStyle->success('Extension installed successfully.');
        return self::INSTALLATION_SUCCESSFUL;
    } elseif ($url = $this->cliInput->getOption('url')) {
        $result = $this->processUrlInstallation($url);
        if (!$result) {
            $this->ioStyle->error('Unable to install extension');
            return self::INSTALLATION_FAILED;
        }
        $this->ioStyle->success('Extension installed successfully.');
        return self::INSTALLATION_SUCCESSFUL;
    }
    $this->ioStyle->error('Invalid argument supplied for command.');
    return self::INSTALLATION_FAILED;
}