0 follower

Class Yiisoft\YiiDevTool\App\Component\Console\YiiDevToolStyle

InheritanceYiisoft\YiiDevTool\App\Component\Console\YiiDevToolStyle » Symfony\Component\Console\Style\SymfonyStyle

Method Details

Hide inherited methods

__construct() public method

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();
}

            
done() public method

public void done ( )

                public function done(): void
{
    $this->success('✔ Done.');
}

            
error() public method

public void error ( mixed $message )
$message mixed

                public function error($message): void
{
    $this->writeln($this->wrap($message, '<error>'));
    $this->newLine();
}

            
hasColorSupport() public method

public boolean hasColorSupport ( )

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

            
header() public method

public void header ( string $message )
$message string

                public function header(string $message): void
{
    $this->writeln([
        '<header>* ' . $message . '</header>',
    ]);
    $this->newLine();
}

            
success() public method

public void success ( mixed $message )
$message mixed

                public function success($message): void
{
    $this->writeln($this->wrap($message, '<success>'));
    $this->newLine();
}

            
warning() public method

public void warning ( mixed $message )
$message mixed

                public function warning($message): void
{
    $this->writeln($this->wrap($message, '<warning>'));
    $this->newLine();
}

            
wrap() protected method

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;
}