Returns a line formatted as ok msg.

@param string $text
@param array  $style

@return string
966231
public function ok(string $text, array $style = []): string
    {
        return $this->line($text, ['fg' => static::GREEN] + $style);
    }
1018898
public function line($string, $style = null, $verbosity = null)
    {
        $styled = $style ? "<$style>$string</$style>" : $string;

        $this->writeln($styled, $this->parseVerbosity($verbosity));
    }
990815
public static function info($message, $style = null) {
		if (is_array($message)) {
			$msg     = unget($message, 'message');
			$args    = $message;
			$message = $msg ? $msg : '';
		} else {
			$args = [];
		}

		return new JsonView([
			'code'    => self::INFO,
			'message' => $message,
			'args'    => $args,
			'style'   => $style
		], ['ajax' => '1']);
	}
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);
    }
15597
protected function _styleToString(&$style) {

        if (is_array($style)) {
            $css = $this->newStyle();
            foreach ($style as $prop => $val) {
                $css[$prop] = $val;
            }
            return $css->css();
        } elseif (is_a($style, '\\s4y\\Style')) {
            return $style->css();
        }
        return $style.PHP_EOL;
    }
656574
public function write(&$text)
    {
        $matches = array();

        if (preg_match_all('/<a(.*?)>/', $text, $matches)) {
            foreach ($matches[1] as $index => $match) {
                $attribs = $this->_parseAttributes($match);
                $attribs['style'] = 'color:#076da0;text-decoration:none';
                $attribs = AnHelperArray::toString($attribs);
                $text = str_replace($matches[0][$index], '<a '.$attribs.' >', $text);
            }
        }

        return $this;
    }
594
public function error(string $text, array $style = []): string
    {
        return $this->line($text, ['fg' => static::RED] + $style);
    }
1359582
public function text(String $text, Array $settings = []) : GD
    {
        return $this->char($text, $settings, 'string');
    }
55903
public static function formatTranslate(string $text, array $args): string
    {
        if ($args === []) {
            return $text;
        }

        return \is_array($args[0]) ? \strtr($text, $args[0]) : \vsprintf($text, $args);
    }
581700
protected function formatText($text) {
        $syntax = [
            '/\<strong\>/m' => "\033[1m",
            '/\<u\>/m' => "\033[4m",
            '/\<dim\>/m' => "\033[2m",
            '/\<fatal\>/m' => "\033[" . $this->colors[self::FATAL] . "m",
            '/\<error\>/m' => "\033[" . $this->colors[self::ERROR] . "m",
            '/\<warning\>/m' => "\033[" . $this->colors[self::WARNING] . "m",
            '/\<notice\>/m' => "\033[" . $this->colors[self::NOTICE] . "m",
            '/\<debug\>/m' => "\033[" . $this->colors[self::DEBUG] . "m",
            '/\<red\>/m' => "\033[31m",
            '/\<yellow\>/m' => "\033[33m",
            '/\<green\>/m' => "\033[32m",
            '/\<grey\>/m' => "\033[37m",
            '/\<\/([a-z]+)\>/m' => "\033[0m",
        ];

        $replacements = '$1';

        if ($this->colorize) {
            $replacements = $syntax;
        }

        $result = preg_replace(
            array_keys($syntax),
            $replacements,
            $text
        );

        if (!is_string($result)) {
            throw new RuntimeException('Unable to format text', ExitApp::RUNTIME_ERROR);
        }

        return $result;
    }
21189
public function getMarkedQuery(string $style = 'error'): array
  {
    $query   = trim($this->query); // MySQL ignores leading whitespace in queries.
    $message = [];

    if (strpos($query, PHP_EOL)!==false && $this->isQueryError())
    {
      // Query is a multi line query.
      // The format of a 1064 message is: %s near '%s' at line %d
      $error_line = trim(strrchr($this->error, ' '));

      // Prepend each line with line number.
      $lines  = explode(PHP_EOL, $query);
      $digits = ceil(log(sizeof($lines) + 1, 10));
      $format = sprintf('%%%dd %%s', $digits);
      foreach ($lines as $i => $line)
      {
        if (($i + 1)==$error_line)
        {
          $message[] = sprintf('<%s>'.$format.'</%s>', $style, $i + 1, OutputFormatter::escape($line), $style);
        }
        else
        {
          $message[] = sprintf($format, $i + 1, OutputFormatter::escape($line));
        }
      }
    }
    else
    {
      // Query is a single line query or a method name.
      $message[] = $query;
    }

    return $message;
  }
157260
public static function infoLine($msg, $lineBefore = true, $afterLinesCount = 2, $color = Console::FG_GREEN)
        {
            $out = '';
            if ($lineBefore) {
                $out .= PHP_EOL;
            }

            $out .= self::colorize($msg, $color, Console::AT_BOLD);

            if ($afterLinesCount) {
                for ($i = 0; $i < $afterLinesCount; $i++) {
                    $out .= PHP_EOL;
                }
            }

            return $out;
        }
24676
protected function format_text($text) {
        // Since we allow output for highlighting, we need to encode html entities.
        // This ensures plaintext html chars don't become valid html.
        $out = s($text);

        $startcount = 0;
        $endcount = 0;

        // Remove end/start pairs that span a few common seperation characters. Allows us to highlight phrases instead of words.
        $regex = '|'.engine::HIGHLIGHT_END.'([ .,-]{0,3})'.engine::HIGHLIGHT_START.'|';
        $out = preg_replace($regex, '$1', $out);

        // Now replace our start and end highlight markers.
        $out = str_replace(engine::HIGHLIGHT_START, '<span class="highlight">', $out, $startcount);
        $out = str_replace(engine::HIGHLIGHT_END, '</span>', $out, $endcount);

        // This makes sure any highlight tags are balanced, incase truncation or the highlight text contained our markers.
        while ($startcount > $endcount) {
            $out .= '</span>';
            $endcount++;
        }
        while ($startcount < $endcount) {
            $out = '<span class="highlight">' . $out;
            $endcount++;
        }

        return parent::format_text($out);
    }
15463
protected function replaceColors($text, $tag, $match, ColorStyle $style)
    {
        $replace = $this->noColors
            ? $match
            : "\033[" . $style . "m" . $match . "\033[0m";

        return str_replace('<' . $tag . '>' . $match . '</' . $tag . '>', $replace, $text);
    }
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;
    }
515011
protected function processInline($text)
    {
        while ($text) {
            if (preg_match(self::MATCH_LINK, $text, $m)) {
                return $this->processLink($m[1], $m[2], $m[3], $m[4]);
            }

            $importantTextAhead = $this->lookAhead($text, self::STRONG_START_END);
            $emphasizedTextAhead = $this->lookAhead($text, self::EMPHASIZED_START_END);

            if ($importantTextAhead === false) {
                $importantTextAhead = $this->lookAhead($text, self::STRONG_START_END_TYPE_2);
            }

            if ($emphasizedTextAhead === false) {
                $emphasizedTextAhead = $this->lookAhead($text, self::EMPHASIZED_START_END_TYPE_2);
            }

            if ($importantTextAhead !== false && $emphasizedTextAhead !== false) {
                if ($importantTextAhead <= $emphasizedTextAhead) {
                    $unformattedText = mb_substr($text, 0, $importantTextAhead);
                    $importantText = mb_substr($text, $importantTextAhead);
                    $this->text($unformattedText);

                    return $this->processStrong($importantText);
                } else {
                    $unformattedText = mb_substr($text, 0, $emphasizedTextAhead);
                    $emphasizedText = mb_substr($text, $emphasizedTextAhead);
                    $this->text($unformattedText);

                    return $this->processEmphasized($emphasizedText);
                }
            } elseif ($importantTextAhead !== false) {
                $unformattedText = mb_substr($text, 0, $importantTextAhead);
                $importantText = mb_substr($text, $importantTextAhead);
                $this->text($unformattedText);

                return $this->processStrong($importantText);
            } elseif ($emphasizedTextAhead !== false) {
                $unformattedText = mb_substr($text, 0, $emphasizedTextAhead);
                $emphasizedText = mb_substr($text, $emphasizedTextAhead);
                $this->text($unformattedText);

                return $this->processEmphasized($emphasizedText);
            }

            $text = $this->processRestOfLine($text);
        };

        return ''; //All text is consumed
    }
868342
public function do_text(
        $text,
        $offsetX = 0,
        $offsetY = 0,
        $opacity = 1.0,
        $color = 0x000000,
        $size = 12,
        $font_file = null
    ) {
        return $this->_handler->do_text($text, $offsetX, $offsetY, $opacity, $color, $size, $font_file);
    }