@param string $text

@return Shortcode
970005
public function unserialize($text)
    {
        $data = json_decode($text, true);

        if (!is_array($data)) {
            throw new \InvalidArgumentException('Invalid JSON, cannot unserialize Shortcode!');
        }
        if (!array_diff_key($data, array('name', 'parameters', 'content'))) {
            throw new \InvalidArgumentException('Malformed Shortcode JSON, expected name, parameters, and content!');
        }

        $name = array_key_exists('name', $data) ? $data['name'] : null;
        $parameters = array_key_exists('parameters', $data) ? $data['parameters'] : array();
        $content = array_key_exists('content', $data) ? $data['content'] : null;
        $bbCode = array_key_exists('bbCode', $data) ? $data['bbCode'] : null;

        if(!is_array($parameters)) {
            throw new \InvalidArgumentException('Parameters must be an array!');
        }

        return new Shortcode($name, $parameters, $content, $bbCode);
    }
1203016
public function writeRawData($text)
    {
        if (is_array($text)) {
            $text = implode("\n", $text);
        }

        if (method_exists($this, 'writeRaw')) {
            return $this->writeRaw(htmlspecialchars($text));
        }

        return $this->text($text);
    }
960849
public static function shorten(string $text = '', ?int $charCount = null, bool $fullWords = true,
                                   string $suffix = '...'): string
    {
        $text = StripTags::strip($text);
        $text = \htmlspecialchars_decode((string)$text, ENT_COMPAT | ENT_HTML5);
        $text = \trim(\preg_replace('/\s+/', ' ', $text));

        if ($charCount === null || \mb_strlen($text, 'UTF-8') <= $charCount) {
            return $text;
        }

        if ($fullWords === true) {
            $shortened = \mb_substr($text, 0, $charCount, 'UTF-8');
            while (!\in_array(\mb_substr($shortened, -1, 1, 'UTF-8'), static::$wordEndingChars)) {
                $shortened = \mb_substr($shortened, 0, -1, 'UTF-8');
            }
        }
        if ($fullWords !== true) {
            $shortened = \mb_substr($text, 0, $charCount, 'UTF-8');
        }

        while (\in_array(\mb_substr($shortened, -1, 1, 'UTF-8'), static::$wordEndingChars)) {
            $shortened = \mb_substr($shortened, 0, -1, 'UTF-8');
        }

        return $shortened.$suffix;
    }
925955
public function read(&$text)
    {
        $text = str_replace(
            array_keys($this->_alias_read),
            array_values($this->_alias_read),
            $text);

        return $this;
    }
1351929
public function smartypants($text): Markup
    {
        $text = $this->normalizeText($text);
        return Template::raw(Typogrify::$plugin->typogrify->smartypants($text));
    }
439128
public static function parse_raw($text)
    {
        $line = new static($text);

        if (! $line->isPair()) {
            return $line;
        }

        return new KeyValue($line->key(), $line->value(), $line->quote());
    }
237969
public function generateLabel(string $text) {
        $args = [
            'w'             => $this->width,
            'h'             => 0,
            'txt'           => $text,
            'border'        => 0,
            'align'         => 'L',
            'fill'          => 0,
            'ln'            => 0,
            'x'             => '',
            'y'             => '',
            'reseth'        => true,
            'stretch'       => 0,
            'ishtml'        => false,
            'autopadding'   => false,
            'maxh'          => $this->height,
        ];

        if (true === $args['ishtml']) {
            $this->writeHTMLCell($args['w'], $args['h'],
                $args['x'], $args['y'],
                $args['txt'], $args['border'],
                $args['ln'], $args['fill'],
                $args['reseth'], $args['align'],
                $args['autopadding']
            );
        } else {
            $this->multiCell($args['w'], $args['h'],
                $args['txt'], $args['border'],
                $args['align'], $args['fill'],
                $args['ln'], $args['x'],
                $args['y'], $args['reseth'],
                $args['stretch'], $args['ishtml'],
                $args['autopadding'], $args['maxh']
            );
        }
    }
253301
public function text( string $text ): string
	{
		$then = $this->getThen();
		if( $this->lang_text )
		{
			return $this->lang->text($text, $then);
		}
		else
		{
			return $text;
		}
	}
711619
static function parse($text)
    {
        $parser = new \Parsedown();

        $text = static::cleanLeadingSpace($text);

        return $parser->text($text);
    }
952876
public function apply($text)
    {
        $setCodes = array();
        $unsetCodes = array();
        if (null !== $this->foreground) {
            $setCodes[] = $this->foreground['set'];
            $unsetCodes[] = $this->foreground['unset'];
        }
        if (null !== $this->background) {
            $setCodes[] = $this->background['set'];
            $unsetCodes[] = $this->background['unset'];
        }
        if (count($this->options)) {
            foreach ($this->options as $option) {
                $setCodes[] = $option['set'];
                $unsetCodes[] = $option['unset'];
            }
        }
        if (0 === count($setCodes)) {
            return $text;
        }
        return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
    }
683955
public function makeHtml($text)
    {
        $this->_footnotes = array();
        $this->_definitions = array();
        $this->_holders = array();
        $this->_uniqid = md5(uniqid());
        $this->_id = 0;
        usort($this->blockParsers, function ($a, $b) {
            return $a[1] < $b[1] ? -1 : 1;
        });
        foreach ($this->blockParsers as $parser) {
            list ($name) = $parser;
            if (isset($parser[2])) {
                $this->_parsers[$name] = $parser[2];
            } else {
                $this->_parsers[$name] = array($this, 'parseBlock' . ucfirst($name));
            }
        }
        $text = $this->initText($text);
        $html = $this->parse($text); 
        $html = $this->makeFootnotes($html);
        $html = $this->optimizeLines($html);
        return $this->call('makeHtml', $html);
    }
730823
protected function replaceTextTokens($text)
    {
        foreach ($this->tokens as $key => $val) {
            $text = str_replace('<' . $key . '>', $val, $text);
        }

        return $text;
    }
278873
public function parser($text)
    {
        //Gets all current class methods, except for `parser()` and `remove()`
        $methods = array_diff(get_child_methods(get_class()), ['parser', 'remove']);

        //Calls dynamically each method
        foreach ($methods as $method) {
            $text = call_user_func([$this, $method], $text);
        }

        return $text;
    }
239476
public static function toHtml($text)
    {
        $text = htmlspecialchars($text);
        $text = nl2br(str_replace(' ', '&nbsp;', $text));
        return $text; //define in QuickPHP\Libs\CoreFunction.inc.php
    }
513255
public function asText($text)
    {
        $stream = StreamFactory::string($text);
        return new Response($stream, self::OK, ['Content-Type' => 'text/plain']);
    }
896853
public static function markdownProcessor($text)
    {
        $MarkdownParser = static::getMarkdownParser();
        $text = $MarkdownParser->parse($text);
        $text = static::emailToLink($text);
        $text = str_replace('<p>h', '<p> h', $text);
        $text = static::urlToLink($text);

        return $text;
    }
1022106
public function line( string $text ): string
	{
		$line = $this->lang->item($text, $this->getThen(), $text);
		return is_array($line) ? reset($line) : (string) $line;
	}