Returns a line formatted as comment.

@param string $text
@param array  $style

@return string
594
public function error(string $text, array $style = []): string
    {
        return $this->line($text, ['fg' => static::RED] + $style);
    }
1185797
public function convertToInlineCss(string $text, string $cssText = null)
    {
        // apply the css inliner
        $objCssInliner = new \TijsVerkoyen\CssToInlineStyles\CssToInlineStyles();

        return $objCssInliner->convert($text, $cssText);
    }
717339
public function addText($text, $styleFont = null, $styleParagraph = null) {
		$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
		$this->_elementCollection[] = $text;
		return $text;
	}
1131200
public function prompt($text) {

        // send out any escaping to implement anything sitting in the desired state
        $this->outputEscapeSequence();

        // save off the prompt string
        $prompt = $text  . $this->promptCaret . " ";

        // prompt and return the answer
        return $this->readUserInput($prompt);

    }
117808
private function applyStyle($style, $text)
    {
        list($startCode, $endCode) = self::$styles[$style];

        return $startCode . $text . $endCode;
    }
6401
public function decorate(Style $style, string $value): string
    {
        if (!$style->isExpand()) {
            return $value;
        }

        $lineWidth = $style->getLineWidth();
        $align = $style->getAlignValue();

        return str_pad($value, $lineWidth, ' ', $align);
    }
1047292
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
        );
    }
651549
function stylize( $styleName, $text )
    {
        $preStyle = $this->style( $styleName );
        $postStyle = $this->style( $styleName . '-end' );
        return $preStyle . $text . $postStyle;
    }
210577
protected function onFormatText(string &$text): void
    {
        $lines = preg_split("/\r\n|\n|\r/", $text);
        $result = [];

        $lastEmptyLinesCount = 0;
        $hasFoundNonEmptyLines = false;

        foreach ($lines as $line) {
            if (($this->textFormatOptions & TextFormatOptions::TRIM) !== 0) {
                $line = trim($line);
            }
            if (($this->textFormatOptions & TextFormatOptions::COMPACT) !== 0) {
                $line = preg_replace('/\s+/', ' ', $line);
            }

            if ($line === '') {
                if (($this->textFormatOptions & TextFormatOptions::COMPACT_LINES) !== 0 && $lastEmptyLinesCount > 0) {
                    continue;
                }
                if (($this->textFormatOptions & TextFormatOptions::TRIM_LINES) !== 0 && !$hasFoundNonEmptyLines) {
                    continue;
                }

                $lastEmptyLinesCount++;
            } else {
                $lastEmptyLinesCount = 0;
                $hasFoundNonEmptyLines = true;
            }

            $result[] = $line;
        }

        if (($this->textFormatOptions & TextFormatOptions::TRIM_LINES) !== 0 && $lastEmptyLinesCount > 0) {
            // Trim the last empty lines (we did not know until now that those were at the end).
            array_splice($result, -$lastEmptyLinesCount);
        }

        $text = implode("\r\n", $result);
    }
720083
public function format($text)
    {
        $lines = explode("\n", $text);
        foreach ($lines as &$line) {
            $line = ($this->quote) . str_repeat(' ', $this->indent) . $line;
        }
        return Colour::colour(implode("\n", $lines), $this->foregroundColors, $this->backgroundColors);
    }
1333010
def line(self, text, style=None, verbosity=None):
        
        if style:
            styled = "<%s>%s</>" % (style, text)
        else:
            styled = text

        self._io.write_line(styled, verbosity)
330629
public static function style($string, $style)
    {
        $escapeSequence = ($style instanceof Style) ? $style->getEscapeSequence() : self::getEscapeSequence($style);
        $resetSequence = ($style instanceof Style) ? Style::getResetSequence() : self::getResetSequence($style);

        return $escapeSequence . $string . $resetSequence;
    }
100713
protected function _parseStyles(&$text)
    {
        $styles = '';

        $matches = array();
        if (preg_match_all('#<style\s*src="([^"]+)"(.*)\/>#iU', $text, $matches)) {
            foreach (array_unique($matches[1]) as $key => $match) {
                $attribs = $this->_parseAttributes($matches[2][$key]);
                $styles .= $this->_renderStyle($match, true, $attribs);
            }

            $text = str_replace($matches[0], '', $text);
        }

        $matches = array();
        if (preg_match_all('#<style(.*)>(.*)<\/style>#siU', $text, $matches)) {
            foreach ($matches[2] as $key => $match) {
                $attribs = $this->_parseAttributes($matches[1][$key]);
                $styles .= $this->_renderStyle($match, false, $attribs);
            }

            $text = str_replace($matches[0], '', $text);
        }

        return $styles;
    }
492440
public function addInline($style, array $attr = null, $position = 1000)
    {
        $this->addElement(
            $position,
            $this->inline($style, $attr)
        );
        return $this;
    }
914480
public static function description(string $comment): string
    {
        $comment = \str_replace("\r", '', \trim(\preg_replace('/^\s*\**( |\t)?/m', '', trim($comment, '/'))));

        if (\preg_match('/^\s*@\w+/m', $comment, $matches, \PREG_OFFSET_CAPTURE)) {
            $comment = \trim(\substr($comment, 0, $matches[0][1]));
        }

        return $comment;
    }
370000
private function get_line_style($line)
    {
        //$style = null;
        $style = null;
        if (isset($this->highlight_extra_lines_styles[$line])) {
            $style = $this->highlight_extra_lines_styles[$line];
        }
        else { // if no "extra" style assigned
            $style = $this->highlight_extra_lines_style;
        }

        return $style;
    }
989397
private static function _eolInComment($line, $inComment)
    {
        while (strlen($line)) {
            if ($inComment) {
                // only "*/" can end the comment
                $index = self::_find($line, '*/');
                if ($index === false) {
                    return true;
                }

                // stop comment and keep walking line
                $inComment = false;
                @$line = (string)substr($line, $index + 2);
                continue;
            }

            // look for "//" and "/*"
            $single = self::_find($line, '//');
            $multi = self::_find($line, '/*');
            if ($multi === false) {
                return false;
            }

            if ($single === false || $multi < $single) {
                // start comment and keep walking line
                $inComment = true;
                @$line = (string)substr($line, $multi + 2);
                continue;
            }

            // a single-line comment preceeded it
            return false;
        }

        return $inComment;
    }