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 "\033[" . implode($styleInfo, ';') . 'm' . $matches['text'] . "\033[0m";
    }
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 "\033[" . implode($styleInfo, ';') . 'm' . $matches['text'] . "\033[0m";
    }
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 "\033[" . implode ( $ styleInfo , ';' ) . 'm' . $ matches [ 'text' ] . "\033[0m" ; }
Replace tags with color codes.

@param array $matches An array of matches to replace.
@return string
Replace tags with color codes .