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

Breadcrumb

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

class OutputStyle

Decorates output to add console style guide helpers.

@author Kevin Bond <kevinbond@gmail.com>

Hierarchy

  • class \Symfony\Component\Console\Style\OutputStyle implements \Symfony\Component\Console\Output\OutputInterface, \Symfony\Component\Console\Style\StyleInterface

Expanded class hierarchy of OutputStyle

File

vendor/symfony/console/Style/OutputStyle.php, line 24

Namespace

Symfony\Component\Console\Style
View source
abstract class OutputStyle implements OutputInterface, StyleInterface {
    public function __construct(OutputInterface $output) {
    }
    public function newLine(int $count = 1) : void {
        $this->output
            ->write(str_repeat(\PHP_EOL, $count));
    }
    public function createProgressBar(int $max = 0) : ProgressBar {
        return new ProgressBar($this->output, $max);
    }
    public function write(string|iterable $messages, bool $newline = false, int $type = self::OUTPUT_NORMAL) : void {
        $this->output
            ->write($messages, $newline, $type);
    }
    public function writeln(string|iterable $messages, int $type = self::OUTPUT_NORMAL) : void {
        $this->output
            ->writeln($messages, $type);
    }
    public function setVerbosity(int $level) : void {
        $this->output
            ->setVerbosity($level);
    }
    public function getVerbosity() : int {
        return $this->output
            ->getVerbosity();
    }
    public function setDecorated(bool $decorated) : void {
        $this->output
            ->setDecorated($decorated);
    }
    public function isDecorated() : bool {
        return $this->output
            ->isDecorated();
    }
    public function setFormatter(OutputFormatterInterface $formatter) : void {
        $this->output
            ->setFormatter($formatter);
    }
    public function getFormatter() : OutputFormatterInterface {
        return $this->output
            ->getFormatter();
    }
    public function isSilent() : bool {
        // @deprecated since Symfony 7.2, change to $this->output->isSilent() in 8.0
        return method_exists($this->output, 'isSilent') ? $this->output
            ->isSilent() : self::VERBOSITY_SILENT === $this->output
            ->getVerbosity();
    }
    public function isQuiet() : bool {
        return $this->output
            ->isQuiet();
    }
    public function isVerbose() : bool {
        return $this->output
            ->isVerbose();
    }
    public function isVeryVerbose() : bool {
        return $this->output
            ->isVeryVerbose();
    }
    public function isDebug() : bool {
        return $this->output
            ->isDebug();
    }
    protected function getErrorOutput() : OutputInterface {
        if (!$this->output instanceof ConsoleOutputInterface) {
            return $this->output;
        }
        return $this->output
            ->getErrorOutput();
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
OutputInterface::OUTPUT_NORMAL public constant
OutputInterface::OUTPUT_PLAIN public constant
OutputInterface::OUTPUT_RAW public constant
OutputInterface::VERBOSITY_DEBUG public constant
OutputInterface::VERBOSITY_NORMAL public constant
OutputInterface::VERBOSITY_QUIET public constant
OutputInterface::VERBOSITY_SILENT public constant
OutputInterface::VERBOSITY_VERBOSE public constant
OutputInterface::VERBOSITY_VERY_VERBOSE public constant
OutputStyle::createProgressBar public function 1
OutputStyle::getErrorOutput protected function
OutputStyle::getFormatter public function Returns current output formatter instance. Overrides OutputInterface::getFormatter
OutputStyle::getVerbosity public function Gets the current verbosity of the output. Overrides OutputInterface::getVerbosity
OutputStyle::isDebug public function Returns whether verbosity is debug (-vvv). Overrides OutputInterface::isDebug
OutputStyle::isDecorated public function Gets the decorated flag. Overrides OutputInterface::isDecorated
OutputStyle::isQuiet public function Returns whether verbosity is quiet (-q). Overrides OutputInterface::isQuiet
OutputStyle::isSilent public function
OutputStyle::isVerbose public function Returns whether verbosity is verbose (-v). Overrides OutputInterface::isVerbose
OutputStyle::isVeryVerbose public function Returns whether verbosity is very verbose (-vv). Overrides OutputInterface::isVeryVerbose
OutputStyle::newLine public function Add newline(s). Overrides StyleInterface::newLine 1
OutputStyle::setDecorated public function Sets the decorated flag. Overrides OutputInterface::setDecorated
OutputStyle::setFormatter public function Overrides OutputInterface::setFormatter
OutputStyle::setVerbosity public function Sets the verbosity of the output. Overrides OutputInterface::setVerbosity
OutputStyle::write public function Writes a message to the output. Overrides OutputInterface::write 1
OutputStyle::writeln public function Writes a message to the output and adds a newline at the end. Overrides OutputInterface::writeln 1
OutputStyle::__construct public function 1
StyleInterface::ask public function Asks a question. 1
StyleInterface::askHidden public function Asks a question with the user input hidden. 1
StyleInterface::caution public function Formats a caution admonition. 1
StyleInterface::choice public function Asks a choice question. 1
StyleInterface::confirm public function Asks for confirmation. 1
StyleInterface::error public function Formats an error result bar. 1
StyleInterface::listing public function Formats a list. 1
StyleInterface::note public function Formats a note admonition. 1
StyleInterface::progressAdvance public function Advances the progress output X steps. 1
StyleInterface::progressFinish public function Finishes the progress output. 1
StyleInterface::progressStart public function Starts the progress output. 1
StyleInterface::section public function Formats a section title. 1
StyleInterface::success public function Formats a success result bar. 1
StyleInterface::table public function Formats a table. 1
StyleInterface::text public function Formats informational text. 1
StyleInterface::title public function Formats a command title. 1
StyleInterface::warning public function Formats an warning result bar. 1
RSS feed
Powered by Drupal