forked from leftypol/leftypol
Upgrade Twig library
This commit is contained in:
parent
22f3a95e0e
commit
0fe5528574
133 changed files with 5080 additions and 1386 deletions
|
@ -32,37 +32,46 @@ class Twig_TokenParser_Include extends Twig_TokenParser
|
|||
{
|
||||
$expr = $this->parser->getExpressionParser()->parseExpression();
|
||||
|
||||
list($variables, $only, $ignoreMissing) = $this->parseArguments();
|
||||
|
||||
return new Twig_Node_Include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
|
||||
}
|
||||
|
||||
protected function parseArguments()
|
||||
{
|
||||
$stream = $this->parser->getStream();
|
||||
|
||||
$ignoreMissing = false;
|
||||
if ($this->parser->getStream()->test(Twig_Token::NAME_TYPE, 'ignore')) {
|
||||
$this->parser->getStream()->next();
|
||||
$this->parser->getStream()->expect(Twig_Token::NAME_TYPE, 'missing');
|
||||
if ($stream->test(Twig_Token::NAME_TYPE, 'ignore')) {
|
||||
$stream->next();
|
||||
$stream->expect(Twig_Token::NAME_TYPE, 'missing');
|
||||
|
||||
$ignoreMissing = true;
|
||||
}
|
||||
|
||||
$variables = null;
|
||||
if ($this->parser->getStream()->test(Twig_Token::NAME_TYPE, 'with')) {
|
||||
$this->parser->getStream()->next();
|
||||
if ($stream->test(Twig_Token::NAME_TYPE, 'with')) {
|
||||
$stream->next();
|
||||
|
||||
$variables = $this->parser->getExpressionParser()->parseExpression();
|
||||
}
|
||||
|
||||
$only = false;
|
||||
if ($this->parser->getStream()->test(Twig_Token::NAME_TYPE, 'only')) {
|
||||
$this->parser->getStream()->next();
|
||||
if ($stream->test(Twig_Token::NAME_TYPE, 'only')) {
|
||||
$stream->next();
|
||||
|
||||
$only = true;
|
||||
}
|
||||
|
||||
$this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
|
||||
$stream->expect(Twig_Token::BLOCK_END_TYPE);
|
||||
|
||||
return new Twig_Node_Include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
|
||||
return array($variables, $only, $ignoreMissing);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the tag name associated with this token parser.
|
||||
*
|
||||
* @param string The tag name
|
||||
* @return string The tag name
|
||||
*/
|
||||
public function getTag()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue