Cake\Console\ConsoleOutput::_replaceTags PHP Méthode

_replaceTags() protected méthode

Replace tags with color codes.
protected _replaceTags ( array $matches ) : string
$matches array An array of matches to replace.
Résultat string
    protected function _replaceTags($matches)
    {
        $style = $this->styles($matches['tag']);
        if (empty($style)) {
            return '<' . $matches['tag'] . '>' . $matches['text'] . '</' . $matches['tag'] . '>';
        }
        $styleInfo = [];
        if (!empty($style['text']) && isset(static::$_foregroundColors[$style['text']])) {
            $styleInfo[] = static::$_foregroundColors[$style['text']];
        }
        if (!empty($style['background']) && isset(static::$_backgroundColors[$style['background']])) {
            $styleInfo[] = static::$_backgroundColors[$style['background']];
        }
        unset($style['text'], $style['background']);
        foreach ($style as $option => $value) {
            if ($value) {
                $styleInfo[] = static::$_options[$option];
            }
        }
        return "[" . implode($styleInfo, ';') . 'm' . $matches['text'] . "";
    }