Class Yiisoft\YiiDevTool\App\Component\Console\OutputManager
| Inheritance | Yiisoft\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.
Public Methods
Method Details
| public mixed __construct ( Yiisoft\YiiDevTool\App\Component\Console\YiiDevToolStyle $io ) | ||
| $io | Yiisoft\YiiDevTool\App\Component\Console\YiiDevToolStyle | |
public function __construct(private YiiDevToolStyle $io)
{
}
| 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);
}
| public self clearPreparedPackageHeader ( ) |
public function clearPreparedPackageHeader(): self
{
$this->preparedPackageHeader = null;
return $this;
}
| 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);
}
| public self done ( ) |
public function done(): self
{
$this->delegateOutputToIO('done');
return $this;
}
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;
}
| public integer getVerbosity ( ) |
public function getVerbosity(): int
{
return $this->io->getVerbosity();
}
| public boolean hasColorSupport ( ) |
public function hasColorSupport(): bool
{
return $this->io->hasColorSupport();
}
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;
}
| public self info ( mixed $message ) | ||
| $message | mixed | |
public function info($message): self
{
$this->delegateOutputToIO('writeln', [$message]);
return $this;
}
| public self newLine ( mixed $count = 1 ) | ||
| $count | mixed | |
public function newLine($count = 1): self
{
$this->delegateOutputToIO('newLine', [$count]);
return $this;
}
| public boolean nothingHasBeenOutput ( ) |
public function nothingHasBeenOutput(): bool
{
return !$this->outputDone;
}
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;
}
| public void setVerbosity ( integer $level ) | ||
| $level | integer | |
public function setVerbosity(int $level): void
{
$this->io->setVerbosity($level);
}
| public self success ( mixed $message ) | ||
| $message | mixed | |
public function success($message): self
{
$this->delegateOutputToIO('success', [$message], true);
return $this;
}
| public self warning ( mixed $message ) | ||
| $message | mixed | |
public function warning($message): self
{
$this->delegateOutputToIO('warning', [$message]);
return $this;
}
Signup or Login in order to comment.