Cake\Console\ConsoleOutput::styleText PHP Method

styleText() public method

Apply styling to text.
public styleText ( string $text ) : string
$text string Text with styling tags.
return string String with color codes added.
    public function styleText($text)
    {
        if ($this->_outputAs == static::RAW) {
            return $text;
        }
        if ($this->_outputAs == static::PLAIN) {
            $tags = implode('|', array_keys(static::$_styles));
            return preg_replace('#</?(?:' . $tags . ')>#', '', $text);
        }
        return preg_replace_callback('/<(?P<tag>[a-z0-9-_]+)>(?P<text>.*?)<\\/(\\1)>/ims', [$this, '_replaceTags'], $text);
    }