You are here

public function Application::doRun in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Application.php \Symfony\Component\Console\Application::doRun()

Runs the current application.

Parameters

InputInterface $input An Input instance:

OutputInterface $output An Output instance:

Return value

int 0 if everything went fine, or an error code

1 call to Application::doRun()
Application::run in vendor/symfony/console/Application.php
Runs the current application.

File

vendor/symfony/console/Application.php, line 162

Class

Application
An Application is the container for a collection of commands.

Namespace

Symfony\Component\Console

Code

public function doRun(InputInterface $input, OutputInterface $output) {
  if (true === $input
    ->hasParameterOption(array(
    '--version',
    '-V',
  ))) {
    $output
      ->writeln($this
      ->getLongVersion());
    return 0;
  }
  $name = $this
    ->getCommandName($input);
  if (true === $input
    ->hasParameterOption(array(
    '--help',
    '-h',
  ))) {
    if (!$name) {
      $name = 'help';
      $input = new ArrayInput(array(
        'command' => 'help',
      ));
    }
    else {
      $this->wantHelps = true;
    }
  }
  if (!$name) {
    $name = $this->defaultCommand;
    $input = new ArrayInput(array(
      'command' => $this->defaultCommand,
    ));
  }

  // the command name MUST be the first element of the input
  $command = $this
    ->find($name);
  $this->runningCommand = $command;
  $exitCode = $this
    ->doRunCommand($command, $input, $output);
  $this->runningCommand = null;
  return $exitCode;
}