summaryrefslogtreecommitdiff
path: root/inc/lib/Twig/TokenParser/Include.php
diff options
context:
space:
mode:
authorBenjamin Southall <applemansigloo@gmail.com>2019-02-26 10:11:12 +1000
committerBenjamin Southall <applemansigloo@gmail.com>2019-02-26 10:11:12 +1000
commitf79395851b044689567e0e6c9504acbcaa742782 (patch)
treeee539aee9ffa90e8accd6f130b30a8ebed7a232e /inc/lib/Twig/TokenParser/Include.php
parent28f32baf0125ca5085266e73dc5071e5814d8e3b (diff)
Twig update to latest Twig 1.x legacy as per vichan
Diffstat (limited to 'inc/lib/Twig/TokenParser/Include.php')
-rw-r--r--inc/lib/Twig/TokenParser/Include.php29
1 files changed, 7 insertions, 22 deletions
diff --git a/inc/lib/Twig/TokenParser/Include.php b/inc/lib/Twig/TokenParser/Include.php
index 4a317868..309f11db 100644
--- a/inc/lib/Twig/TokenParser/Include.php
+++ b/inc/lib/Twig/TokenParser/Include.php
@@ -3,8 +3,8 @@
/*
* This file is part of Twig.
*
- * (c) 2009 Fabien Potencier
- * (c) 2009 Armin Ronacher
+ * (c) Fabien Potencier
+ * (c) Armin Ronacher
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -21,13 +21,6 @@
*/
class Twig_TokenParser_Include extends Twig_TokenParser
{
- /**
- * Parses a token and returns a node.
- *
- * @param Twig_Token $token A Twig_Token instance
- *
- * @return Twig_NodeInterface A Twig_NodeInterface instance
- */
public function parse(Twig_Token $token)
{
$expr = $this->parser->getExpressionParser()->parseExpression();
@@ -42,24 +35,19 @@ class Twig_TokenParser_Include extends Twig_TokenParser
$stream = $this->parser->getStream();
$ignoreMissing = false;
- if ($stream->test(Twig_Token::NAME_TYPE, 'ignore')) {
- $stream->next();
+ if ($stream->nextIf(Twig_Token::NAME_TYPE, 'ignore')) {
$stream->expect(Twig_Token::NAME_TYPE, 'missing');
$ignoreMissing = true;
}
$variables = null;
- if ($stream->test(Twig_Token::NAME_TYPE, 'with')) {
- $stream->next();
-
+ if ($stream->nextIf(Twig_Token::NAME_TYPE, 'with')) {
$variables = $this->parser->getExpressionParser()->parseExpression();
}
$only = false;
- if ($stream->test(Twig_Token::NAME_TYPE, 'only')) {
- $stream->next();
-
+ if ($stream->nextIf(Twig_Token::NAME_TYPE, 'only')) {
$only = true;
}
@@ -68,13 +56,10 @@ class Twig_TokenParser_Include extends Twig_TokenParser
return array($variables, $only, $ignoreMissing);
}
- /**
- * Gets the tag name associated with this token parser.
- *
- * @return string The tag name
- */
public function getTag()
{
return 'include';
}
}
+
+class_alias('Twig_TokenParser_Include', 'Twig\TokenParser\IncludeTokenParser', false);