Class Yiisoft\YiiDevTool\App\Component\Console\YiiDevToolStyle
| Inheritance | Yiisoft\YiiDevTool\App\Component\Console\YiiDevToolStyle » Symfony\Component\Console\Style\SymfonyStyle |
|---|
Public Methods
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| wrap() | Yiisoft\YiiDevTool\App\Component\Console\YiiDevToolStyle |
Method Details
| public mixed __construct ( \Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output ) | ||
| $input | \Symfony\Component\Console\Input\InputInterface | |
| $output | \Symfony\Component\Console\Output\OutputInterface | |
public function __construct(InputInterface $input, OutputInterface $output)
{
parent::__construct($input, $output);
$formatter = $output->getFormatter();
$formatter->setStyle('package', new OutputFormatterStyle('cyan', null, ['bold']));
$formatter->setStyle('file', new OutputFormatterStyle('blue', null, ['bold']));
$formatter->setStyle('error', new OutputFormatterStyle('red', null, ['bold']));
$formatter->setStyle('warning', new OutputFormatterStyle('yellow'));
$formatter->setStyle('success', new OutputFormatterStyle('green'));
$formatter->setStyle('header', new OutputFormatterStyle('white', null, ['bold']));
$formatter->setStyle('cmd', new OutputFormatterStyle('green', null, ['bold']));
$formatter->setStyle('em', new OutputFormatterStyle('yellow', null, ['bold']));
$this->hasColorSupport = $formatter->isDecorated();
}
| public void error ( mixed $message ) | ||
| $message | mixed | |
public function error($message): void
{
$this->writeln($this->wrap($message, '<error>'));
$this->newLine();
}
| public boolean hasColorSupport ( ) |
public function hasColorSupport(): bool
{
return $this->hasColorSupport;
}
| public void header ( string $message ) | ||
| $message | string | |
public function header(string $message): void
{
$this->writeln([
'<header>* ' . $message . '</header>',
]);
$this->newLine();
}
| public void success ( mixed $message ) | ||
| $message | mixed | |
public function success($message): void
{
$this->writeln($this->wrap($message, '<success>'));
$this->newLine();
}
| public void warning ( mixed $message ) | ||
| $message | mixed | |
public function warning($message): void
{
$this->writeln($this->wrap($message, '<warning>'));
$this->newLine();
}
| protected mixed wrap ( mixed $message, string $tag ) | ||
| $message | mixed | |
| $tag | string | |
protected function wrap($message, string $tag)
{
if (!is_array($message)) {
$message = [$message];
}
$count = count($message);
if ($count) {
$message[0] = "{$tag}{$message[0]}";
$message[$count - 1] .= '</>';
}
return $message;
}
Signup or Login in order to comment.