From a4565e88edbc8e3bd092a475469769c86a4c350c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 2 Aug 2013 22:40:51 +0200 Subject: add Twig & refactor poche --- inc/Twig/Filter/Function.php | 37 +++++++++++++++++++++++++++++++++++++ inc/Twig/Filter/Method.php | 39 +++++++++++++++++++++++++++++++++++++++ inc/Twig/Filter/Node.php | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 inc/Twig/Filter/Function.php create mode 100644 inc/Twig/Filter/Method.php create mode 100644 inc/Twig/Filter/Node.php (limited to 'inc/Twig/Filter') diff --git a/inc/Twig/Filter/Function.php b/inc/Twig/Filter/Function.php new file mode 100644 index 00000000..ad374a55 --- /dev/null +++ b/inc/Twig/Filter/Function.php @@ -0,0 +1,37 @@ + + * @deprecated since 1.12 (to be removed in 2.0) + */ +class Twig_Filter_Function extends Twig_Filter +{ + protected $function; + + public function __construct($function, array $options = array()) + { + $options['callable'] = $function; + + parent::__construct($options); + + $this->function = $function; + } + + public function compile() + { + return $this->function; + } +} diff --git a/inc/Twig/Filter/Method.php b/inc/Twig/Filter/Method.php new file mode 100644 index 00000000..63c8c3be --- /dev/null +++ b/inc/Twig/Filter/Method.php @@ -0,0 +1,39 @@ + + * @deprecated since 1.12 (to be removed in 2.0) + */ +class Twig_Filter_Method extends Twig_Filter +{ + protected $extension; + protected $method; + + public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) + { + $options['callable'] = array($extension, $method); + + parent::__construct($options); + + $this->extension = $extension; + $this->method = $method; + } + + public function compile() + { + return sprintf('$this->env->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); + } +} diff --git a/inc/Twig/Filter/Node.php b/inc/Twig/Filter/Node.php new file mode 100644 index 00000000..8744c5e0 --- /dev/null +++ b/inc/Twig/Filter/Node.php @@ -0,0 +1,39 @@ + + * @deprecated since 1.12 (to be removed in 2.0) + */ +class Twig_Filter_Node extends Twig_Filter +{ + protected $class; + + public function __construct($class, array $options = array()) + { + parent::__construct($options); + + $this->class = $class; + } + + public function getClass() + { + return $this->class; + } + + public function compile() + { + } +} -- cgit v1.2.3