You are here

protected function Application::configureIO in Zircon Profile 8

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

Configures the input and output instances based on the user arguments and options.

Parameters

InputInterface $input An InputInterface instance:

OutputInterface $output An OutputInterface instance:

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

File

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

Class

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

Namespace

Symfony\Component\Console

Code

protected function configureIO(InputInterface $input, OutputInterface $output) {
  if (true === $input
    ->hasParameterOption(array(
    '--ansi',
  ))) {
    $output
      ->setDecorated(true);
  }
  elseif (true === $input
    ->hasParameterOption(array(
    '--no-ansi',
  ))) {
    $output
      ->setDecorated(false);
  }
  if (true === $input
    ->hasParameterOption(array(
    '--no-interaction',
    '-n',
  ))) {
    $input
      ->setInteractive(false);
  }
  elseif (function_exists('posix_isatty') && $this
    ->getHelperSet()
    ->has('question')) {
    $inputStream = $this
      ->getHelperSet()
      ->get('question')
      ->getInputStream();
    if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
      $input
        ->setInteractive(false);
    }
  }
  if (true === $input
    ->hasParameterOption(array(
    '--quiet',
    '-q',
  ))) {
    $output
      ->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  }
  else {
    if ($input
      ->hasParameterOption('-vvv') || $input
      ->hasParameterOption('--verbose=3') || $input
      ->getParameterOption('--verbose') === 3) {
      $output
        ->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
    }
    elseif ($input
      ->hasParameterOption('-vv') || $input
      ->hasParameterOption('--verbose=2') || $input
      ->getParameterOption('--verbose') === 2) {
      $output
        ->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
    }
    elseif ($input
      ->hasParameterOption('-v') || $input
      ->hasParameterOption('--verbose=1') || $input
      ->hasParameterOption('--verbose') || $input
      ->getParameterOption('--verbose')) {
      $output
        ->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
    }
  }
}