From: Fabien Potencier Date: Mon, 12 Jul 2010 16:28:53 +0000 (+0200) Subject: added a new shortcut in the SimpleTokenParser X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=9962161441f78c27a14268574fcae46853f10fdd;p=konrad%2Ftwig.git added a new shortcut in the SimpleTokenParser --- 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(