phpbb/phpBB/includes/template/twig/tokenparser/event.php
Nathan Guse b775f67128 [feature/twig] More work on the lexer
Committing what I have now to save it as I'm trying another method next

PHPBB3-11598
2013-06-10 10:00:22 -05:00

58 lines
1.2 KiB
PHP

<?php
/*
* This file is part of Twig.
*
* (c) 2009 Fabien Potencier
* (c) 2009 Armin Ronacher
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Includes a template.
*
* <pre>
* {% include 'header.html' %}
* Body
* {% include 'footer.html' %}
* </pre>
*/
class phpbb_template_twig_tokenparser_event extends Twig_TokenParser_Include
{
protected function parseArguments()
{
$stream = $this->parser->getStream();
$ignoreMissing = true;
$variables = null;
if ($stream->test(Twig_Token::NAME_TYPE, 'with')) {
$stream->next();
$variables = $this->parser->getExpressionParser()->parseExpression();
}
$only = false;
if ($stream->test(Twig_Token::NAME_TYPE, 'only')) {
$stream->next();
$only = true;
}
$stream->expect(Twig_Token::BLOCK_END_TYPE);
return array($variables, $only, $ignoreMissing);
}
/**
* Gets the tag name associated with this token parser.
*
* @return string The tag name
*/
public function getTag()
{
return 'EVENT';
}
}