League\CommonMark\InlineParserEngine::addPlainText PHP Method

addPlainText() private method

private addPlainText ( string $character, League\CommonMark\Node\Node $container, InlineParserContext $inlineParserContext )
$character string
$container League\CommonMark\Node\Node
$inlineParserContext InlineParserContext
    private function addPlainText($character, Node $container, InlineParserContext $inlineParserContext)
    {
        // We reach here if none of the parsers can handle the input
        // Attempt to match multiple non-special characters at once
        $text = $inlineParserContext->getCursor()->match($this->environment->getInlineParserCharacterRegex());
        // This might fail if we're currently at a special character which wasn't parsed; if so, just add that character
        if ($text === null) {
            $inlineParserContext->getCursor()->advance();
            $text = $character;
        }
        $lastInline = $container->lastChild();
        if ($lastInline instanceof Text && !isset($lastInline->data['delim'])) {
            $lastInline->append($text);
        } else {
            $container->appendChild(new Text($text));
        }
    }