From 9962161441f78c27a14268574fcae46853f10fdd Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 12 Jul 2010 18:28:53 +0200 Subject: [PATCH] added a new shortcut in the SimpleTokenParser --- lib/Twig/SimpleTokenParser.php | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Twig/SimpleTokenParser.php b/lib/Twig/SimpleTokenParser.php index 1eb0cf1..d95f2b1 100644 --- a/lib/Twig/SimpleTokenParser.php +++ b/lib/Twig/SimpleTokenParser.php @@ -45,17 +45,22 @@ abstract class Twig_SimpleTokenParser extends Twig_TokenParser */ abstract protected function getNode(array $values, $line); - protected function getAttribute($node, $attribute, $arguments = array(), $line = -1) + protected function getAttribute($node, $attribute, $arguments = array(), $type = Twig_Node_Expression_GetAttr::TYPE_ANY, $line = -1) { return new Twig_Node_Expression_GetAttr( $node instanceof Twig_NodeInterface ? $node : new Twig_Node_Expression_Name($node, $line), $attribute instanceof Twig_NodeInterface ? $attribute : new Twig_Node_Expression_Constant($attribute, $line), $arguments instanceof Twig_NodeInterface ? $arguments : new Twig_Node($arguments), - Twig_Node_Expression_GetAttr::TYPE_ANY, + $type, $line ); } + protected function call($node, $attribute, $arguments = array(), $line = -1) + { + return $this->getAttribute($node, $attribute, $arguments, Twig_Node_Expression_GetAttr::TYPE_METHOD, $line); + } + protected function markAsSafe(Twig_NodeInterface $node, $line = -1) { return new Twig_Node_Expression_Filter( -- 1.7.2.5