Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | /* |
---|
4 | * This file is part of Twig. |
---|
5 | * |
---|
6 | * (c) 2010 Fabien Potencier |
---|
7 | * |
---|
8 | * For the full copyright and license information, please view the LICENSE |
---|
9 | * file that was distributed with this source code. |
---|
10 | */ |
---|
11 | |
---|
12 | /** |
---|
13 | * Represents a method template test. |
---|
14 | * |
---|
15 | * @package twig |
---|
16 | * @author Fabien Potencier <fabien@symfony.com> |
---|
17 | * @deprecated since 1.12 (to be removed in 2.0) |
---|
18 | */ |
---|
19 | class Twig_Test_Method extends Twig_Test |
---|
20 | { |
---|
21 | protected $extension; |
---|
22 | protected $method; |
---|
23 | |
---|
24 | public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) |
---|
25 | { |
---|
26 | $options['callable'] = array($extension, $method); |
---|
27 | |
---|
28 | parent::__construct($options); |
---|
29 | |
---|
30 | $this->extension = $extension; |
---|
31 | $this->method = $method; |
---|
32 | } |
---|
33 | |
---|
34 | public function compile() |
---|
35 | { |
---|
36 | return sprintf('$this->env->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); |
---|
37 | } |
---|
38 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.