From 5f0d582d1e3fa721b6e70841cd1755cdf7eba9c9 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 28 Nov 2010 13:53:37 +0100 Subject: [PATCH] added Twig_Test_Method --- lib/Twig/Test/Method.php | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) create mode 100644 lib/Twig/Test/Method.php diff --git a/lib/Twig/Test/Method.php b/lib/Twig/Test/Method.php new file mode 100644 index 0000000..758321a --- /dev/null +++ b/lib/Twig/Test/Method.php @@ -0,0 +1,32 @@ + + */ +class Twig_Test_Method implements Twig_TestInterface +{ + protected $extension, $method; + + public function __construct(Twig_ExtensionInterface $extension, $method) + { + $this->extension = $extension; + $this->method = $method; + } + + public function compile() + { + return sprintf('$this->getEnvironment()->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); + } +} -- 1.7.2.5