Writes some text to the text writer

@see TextWriter::write()
@param string $text
@param array $formatOptions
@return Console
168364
public function write($text, $pipe = TextWriter::STDOUT)
    {
        $this->textWriter->write($text, $pipe);
        return $this;
    }
343037
function WriteText($x, $y, $txt)
	{
		// Output a string using Text() but does encoding and text reversing of RTL
		$txt = $this->purify_utf8_text($txt);
		if ($this->text_input_as_HTML) {
			$txt = $this->all_entities_to_utf8($txt);
		}
		if ($this->usingCoreFont) {
			$txt = mb_convert_encoding($txt, $this->mb_enc, 'UTF-8');
		}

		// DIRECTIONALITY
		if (preg_match("/([" . $this->pregRTLchars . "])/u", $txt)) {
			$this->biDirectional = true;
		} // *OTL*

		$textvar = 0;
		$save_OTLtags = $this->OTLtags;
		$this->OTLtags = [];
		if ($this->useKerning) {
			if ($this->CurrentFont['haskernGPOS']) {
				$this->OTLtags['Plus'] .= ' kern';
			} else {
				$textvar = ($textvar | TextVars::FC_KERNING);
			}
		}

		/* -- OTL -- */
		// Use OTL OpenType Table Layout - GSUB & GPOS
		if (isset($this->CurrentFont['useOTL']) && $this->CurrentFont['useOTL']) {
			$txt = $this->otl->applyOTL($txt, $this->CurrentFont['useOTL']);
			$OTLdata = $this->otl->OTLdata;
		}
		/* -- END OTL -- */
		$this->OTLtags = $save_OTLtags;

		$this->magic_reverse_dir($txt, $this->directionality, $OTLdata);

		$this->Text($x, $y, $txt, $OTLdata, $textvar);
	}
239816
public function highlight($text, array $options = []) {
		$options += $this->_config;

		$text = $this->_prepare($text);

		if ($options['escape'] !== false) {
			$text = h($text);
		}

		$attr = ['class' => $options['prefix'] . $options['lang']];

		$options['attr'] = $this->templater()->formatAttributes($attr);
		$options['content'] = $text;

		return $this->templater()->format('code', $options);
	}
1321385
public function write($message, $newLine = false, $formatType = self::OUTPUT_NORMAL) {
        if ($formatType === self::OUTPUT_NORMAL) {
            $message = $this->getFormatter()->format($message);
        }

        if ($newLine) {
            $message .= \PHP_EOL;
        }
        return \fwrite($this->stream, $message);
    }
178947
protected function sprintf(string $format, ...$args)
    {
        return $this->output->write(sprintf($format, ...$args), false);
    }
804748
public function write($text = '', $style = 'none') {
        if (is_array($text)) {
            $max = 0;

            foreach($text as $txt) {
                $max = max($max, strlen($txt));
            }

            $outline = str_repeat(' ', $max + 4);
            $this->writeln($outline, $style);

            foreach($text as $txt) {
                $len = strlen($txt);
                $pre_space  = str_repeat(' ', 2);
                $post_space = str_repeat(' ', $max + 2 - $len);
                $this->writeln($pre_space . $txt . $post_space, $style);
            }

            $this->writeln($outline, $style);
        }
        else {
            echo $this->applyStyle($text, $style);
        }
    }
1033306
public function writeLineIndented($string, $spaces = 2, $options = null) {
        return $this->writeLine($this->indent($string, $spaces), $options);
    }
391546
public function setText(string $text): self
    {
        return $this->addPart(Part::create($text, 'text/plain'), true);
    }
339119
public function lexerCustom($text, $options=array()){

        $data = array();
        
        $data['text'] = $text;

        $data = array_merge($data, $options);
        $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8');

        return $this->request($this->lexerCustomUrl, $data);
    }
938145
function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL) {
        //use some whitespace to indicate where there was some line spacing.
        $text = str_replace(array('</p>', "\n", "\r"), '   ', $text);
        return strip_tags($text);
    }
122248
public function addTextBlock($text, $blockOptions = self::COMMONS_OPTIONS)
    {
        $this->addBlock("TextBlock", $blockOptions);
        $this->setData("text", $text);

        return $this;
    }
198986
protected function write($string, $format = true)
    {
        if ($format) {
            $string .= $this->delimiter;
        }

        $string .= "\n";

        if (fwrite($this->file, $string, strlen($string)) === false) {
            throw new Exception('Unable to write '.strlen($string).' bytes to the dumpfile.');
        }
    }
915022
public function format_answer($answer, $context, $answerformat, $options = []) {

        if (is_object($options)) {
            $options = (array) $options;
        }

        if (empty($options['context'])) {
            $options['context'] = $context;
        }

        if (empty($options['para'])) {
            $options['para'] = true;
        }

        return format_text($answer, $answerformat, $options);
    }
998173
public function format($options = [], $textOptions = [])
    {
        return \Yii::$app->money->format($this, $options, $textOptions);
    }
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;
    }
143316
public function write(&$text)
    {
        $matches = array();

        if (strpos($text, '<html')) {

            //add language
            $text = str_replace('<html', '<html lang="'.$this->getService('anahita:language')->getTag().'"', $text);

            //render the styles
            $text = str_replace('</head>', $this->_renderHead().$this->_renderStyles().'</head>', $text);

            //render the scripts
            $text = str_replace('</body>', $this->_renderScripts().'</body>', $text);
        }
    }
1123994
private function _createLine(array $formatterConfig)
    {
        $boolValues = array(
            'true'  => true,
            'false' => false,
        );

        $format = null;
        if (true === array_key_exists('format', $formatterConfig)) {
            $format = $formatterConfig['format'];
        }

        $dateFormat = null;
        if (true === array_key_exists('dateFormat', $formatterConfig)) {
            $dateFormat = $formatterConfig['dateFormat'];
        }

        $includeStacktraces = false;
        if (true === array_key_exists('includeStacktraces', $formatterConfig)
            && true === array_key_exists($formatterConfig['includeStacktraces'], $boolValues)
        ) {
            $includeStacktraces = $boolValues[$formatterConfig['includeStacktraces']];
        }

        $allowInlineLineBreaks = false;
        if (true === array_key_exists('allowInlineLineBreaks', $formatterConfig)
            && true === array_key_exists($formatterConfig['allowInlineLineBreaks'], $boolValues)
        ) {
            $allowInlineLineBreaks = $boolValues[$formatterConfig['allowInlineLineBreaks']];
        }

        $ignoreEmptyContextAndExtra = false;
        if (true === array_key_exists('ignoreEmptyContextAndExtra', $formatterConfig)
            && true === array_key_exists($formatterConfig['ignoreEmptyContextAndExtra'], $boolValues)
        ) {
            $ignoreEmptyContextAndExtra = $boolValues[$formatterConfig['ignoreEmptyContextAndExtra']];
        }

        $formatter = new Monolog\Formatter\LineFormatter($format, $dateFormat);
        $formatter->includeStacktraces($includeStacktraces);
        $formatter->allowInlineLineBreaks($allowInlineLineBreaks);
        $formatter->ignoreEmptyContextAndExtra($ignoreEmptyContextAndExtra);

        return $formatter;
    }