protected function processRawContentTagTokens(array $tokens) : array
    {
        $rawTagName = null;
        return array_reduce($tokens, function (array $tokens, $token) use (&$rawTagName) {
            if (!isset($rawTagName)) {
                // If not in a raw-content tag and current tag is a raw-content, store a tag name.
                if ($token instanceof TagToken) {
                    $tagName = $token->getTagName();
                    $tagDef = $this->tagDefs->get($tagName);
                    if ($tagDef->rawContent()) {
                        $rawTagName = $tagName;
                    }
                }
            } elseif ($token instanceof TagToken && $token->getTagName() === $rawTagName) {
                // If in a raw-content tag and current tag is closing for it, unset the stored tag name.
                $rawTagName = null;
            } else {
                // If in a raw-content tag, return current token as a text token.
                $text = $token->getRawText();
                $token = new TextToken($text);
            }

            // Append current token.
            return array_merge($tokens, [$token]);
        }, []);
    }
protected function processRawContentTagTokens(array $tokens) : array
    {
        $rawTagName = null;
        return array_reduce($tokens, function (array $tokens, $token) use (&$rawTagName) {
            if (!isset($rawTagName)) {
                // If not in a raw-content tag and current tag is a raw-content, store a tag name.
                if ($token instanceof TagToken) {
                    $tagName = $token->getTagName();
                    $tagDef = $this->tagDefs->get($tagName);
                    if ($tagDef->rawContent()) {
                        $rawTagName = $tagName;
                    }
                }
            } elseif ($token instanceof TagToken && $token->getTagName() === $rawTagName) {
                // If in a raw-content tag and current tag is closing for it, unset the stored tag name.
                $rawTagName = null;
            } else {
                // If in a raw-content tag, return current token as a text token.
                $text = $token->getRawText();
                $token = new TextToken($text);
            }

            // Append current token.
            return array_merge($tokens, [$token]);
        }, []);
    }
protected function processRawContentTagTokens ( array $ tokens ) : array { $ rawTagName = null ; return array_reduce ( $ tokens , function ( array $ tokens , $ token ) use ( & $ rawTagName ) { if ( ! isset ( $ rawTagName ) ) { // If not in a raw-content tag and current tag is a raw-content, store a tag name. if ( $ token instanceof TagToken ) { $ tagName = $ token -> getTagName ( ) ; $ tagDef = $ this -> tagDefs -> get ( $ tagName ) ; if ( $ tagDef -> rawContent ( ) ) { $ rawTagName = $ tagName ; } } } elseif ( $ token instanceof TagToken && $ token -> getTagName ( ) === $ rawTagName ) { // If in a raw-content tag and current tag is closing for it, unset the stored tag name. $ rawTagName = null ; } else { // If in a raw-content tag, return current token as a text token. $ text = $ token -> getRawText ( ) ; $ token = new TextToken ( $ text ) ; } // Append current token. return array_merge ( $ tokens , [ $ token ] ) ; } , [ ] ) ; }
Converts child tags of raw-content tags to a raw text.

Used in tokenize().

@param Token[] $tokens

@return Token[]
Converts child tags of raw - content tags to a raw text .