/** * Parse the input as text until a closing tag has been found for the node. * * @param TagNode $node * @param string $name */ private function parseAsText($node, $name) { $closer = '/' . $name; if (($first = next($this->tokens)) === false) { return; } if (($second = next($this->tokens)) === false) { return; } if (($third = next($this->tokens)) === false) { return; } // Check that the inputs are [$closer]. If not then keep cycling until closed. while ($first !== '[' || $second !== $closer || $third !== ']') { $node->curText->text .= $first; $first = $second; $second = $third; if (($third = next($this->tokens)) === false) { $node->curText->text .= $first . $second; return; } } // Success! $node->close(); }