getLine(); $beginName = $this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(); $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); $body = $this->parser->subparse(array($this, 'decideBeginFork')); if ($this->parser->getStream()->next()->getValue() == 'BEGINELSE') { $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); $else = $this->parser->subparse(array($this, 'decideBeginEnd'), true); } else { $else = null; } $this->parser->getStream()->expect(Twig_Token::NAME_TYPE, $beginName); $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); return new phpbb_template_twig_node_begin($beginName, $body, $else, $lineno, $this->getTag()); } public function decideBeginFork(Twig_Token $token) { return $token->test(array('BEGINELSE', 'END')); } public function decideBeginEnd(Twig_Token $token) { return $token->test('END'); } /** * Gets the tag name associated with this token parser. * * @return string The tag name */ public function getTag() { return 'BEGIN'; } }