Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Application.php

function Application::configureIO

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

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

File

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

Class

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

Namespace

Symfony\Component\Console

Code

protected function configureIO(InputInterface $input, OutputInterface $output) : void {
    if (true === $input->hasParameterOption([
        '--ansi',
    ], true)) {
        $output->setDecorated(true);
    }
    elseif (true === $input->hasParameterOption([
        '--no-ansi',
    ], true)) {
        $output->setDecorated(false);
    }
    if (true === $input->hasParameterOption([
        '--no-interaction',
        '-n',
    ], true)) {
        $input->setInteractive(false);
    }
    switch ($shellVerbosity = (int) getenv('SHELL_VERBOSITY')) {
        case -2:
            $output->setVerbosity(OutputInterface::VERBOSITY_SILENT);
            break;
        case -1:
            $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
            break;
        case 1:
            $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
            break;
        case 2:
            $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
            break;
        case 3:
            $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
            break;
        default:
            $shellVerbosity = 0;
            break;
    }
    if (true === $input->hasParameterOption([
        '--silent',
    ], true)) {
        $output->setVerbosity(OutputInterface::VERBOSITY_SILENT);
        $shellVerbosity = -2;
    }
    elseif (true === $input->hasParameterOption([
        '--quiet',
        '-q',
    ], true)) {
        $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
        $shellVerbosity = -1;
    }
    else {
        if ($input->hasParameterOption('-vvv', true) || $input->hasParameterOption('--verbose=3', true) || 3 === $input->getParameterOption('--verbose', false, true)) {
            $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
            $shellVerbosity = 3;
        }
        elseif ($input->hasParameterOption('-vv', true) || $input->hasParameterOption('--verbose=2', true) || 2 === $input->getParameterOption('--verbose', false, true)) {
            $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
            $shellVerbosity = 2;
        }
        elseif ($input->hasParameterOption('-v', true) || $input->hasParameterOption('--verbose=1', true) || $input->hasParameterOption('--verbose', true) || $input->getParameterOption('--verbose', false, true)) {
            $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
            $shellVerbosity = 1;
        }
    }
    if (0 > $shellVerbosity) {
        $input->setInteractive(false);
    }
    if (\function_exists('putenv')) {
        @putenv('SHELL_VERBOSITY=' . $shellVerbosity);
    }
    $_ENV['SHELL_VERBOSITY'] = $shellVerbosity;
    $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal