0 follower

Class Yiisoft\YiiDevTool\App\Component\Console\OutputManager

InheritanceYiisoft\YiiDevTool\App\Component\Console\OutputManager

Determines whether to output messages in the current environment.

If a console command operates in a verbose mode, output all messages. Otherwise, it output only those messages that are marked as important.

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( Yiisoft\YiiDevTool\App\Component\Console\YiiDevToolStyle $io )
$io Yiisoft\YiiDevTool\App\Component\Console\YiiDevToolStyle

                public function __construct(private YiiDevToolStyle $io)
{
}

            
choice() public method

public mixed choice ( string $question, array $choices, mixed $default null )
$question string
$choices array
$default mixed

                public function choice(string $question, array $choices, $default = null)
{
    return $this->delegateOutputToIO('choice', [$question, $choices, $default], true);
}

            
clearPreparedPackageHeader() public method

public self clearPreparedPackageHeader ( )

                public function clearPreparedPackageHeader(): self
{
    $this->preparedPackageHeader = null;
    return $this;
}

            
confirm() public method

public boolean confirm ( string $question, boolean $default true )
$question string
$default boolean

                public function confirm(string $question, bool $default = true): bool
{
    return $this->delegateOutputToIO('confirm', [$question, $default], true);
}

            
done() public method

public self done ( )

                public function done(): self
{
    $this->delegateOutputToIO('done');
    return $this;
}

            
error() public method

Error messages are always displayed regardless of anything.

There is no need to mark them important.

public $this error ( mixed $message )
$message mixed

                public function error($message): self
{
    $this->delegateOutputToIO('error', [$message], true);
    return $this;
}

            
getVerbosity() public method

public integer getVerbosity ( )

                public function getVerbosity(): int
{
    return $this->io->getVerbosity();
}

            
hasColorSupport() public method

public boolean hasColorSupport ( )

                public function hasColorSupport(): bool
{
    return $this->io->hasColorSupport();
}

            
important() public method

Marks whether the next message is important or not.

Important messages are always displayed regardless of anything.

public $this important ( boolean $isImportant true )
$isImportant boolean

                public function important($isImportant = true): self
{
    $this->nextMessageIsImportant = $isImportant;
    return $this;
}

            
info() public method

public self info ( mixed $message )
$message mixed

                public function info($message): self
{
    $this->delegateOutputToIO('writeln', [$message]);
    return $this;
}

            
isVerbose() public method

public boolean isVerbose ( )

                public function isVerbose(): bool
{
    return $this->io->isVerbose();
}

            
newLine() public method

public self newLine ( mixed $count 1 )
$count mixed

                public function newLine($count = 1): self
{
    $this->delegateOutputToIO('newLine', [$count]);
    return $this;
}

            
nothingHasBeenOutput() public method

public boolean nothingHasBeenOutput ( )

                public function nothingHasBeenOutput(): bool
{
    return !$this->outputDone;
}

            
preparePackageHeader() public method

It only prepares a package header for output, but does not output it.

The header will be automatically displayed later before the first message that will require output. If a console command operates in a verbose mode, a detailed header will be prepared, otherwise a short one.

public $this preparePackageHeader ( Yiisoft\YiiDevTool\App\Component\Package\Package $package, string $header )
$package Yiisoft\YiiDevTool\App\Component\Package\Package
$header string

A detailed version of header. Substring '{package}' will be replaced by the name of the package.

                public function preparePackageHeader(Package $package, string $header): self
{
    $io = $this->io;
    $formattedPackageId = "<package>{$package->getId()}</package>";
    if ($io->isVerbose()) {
        $this->preparedPackageHeader = str_replace('{package}', $formattedPackageId, $header);
    } else {
        $this->preparedPackageHeader = $formattedPackageId;
    }
    return $this;
}

            
setVerbosity() public method

public void setVerbosity ( integer $level )
$level integer

                public function setVerbosity(int $level): void
{
    $this->io->setVerbosity($level);
}

            
success() public method

public self success ( mixed $message )
$message mixed

                public function success($message): self
{
    $this->delegateOutputToIO('success', [$message], true);
    return $this;
}

            
warning() public method

public self warning ( mixed $message )
$message mixed

                public function warning($message): self
{
    $this->delegateOutputToIO('warning', [$message]);
    return $this;
}

            
write() public method

public self write ( mixed $message )
$message mixed

                public function write($message): self
{
    $this->delegateOutputToIO('write', [$message]);
    return $this;
}