1<?php 2 3/* 4 * This file is part of Twig. 5 * 6 * (c) 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 12use Twig\Extension\ExtensionInterface; 13 14@trigger_error('The Twig_Filter_Method class is deprecated since version 1.12 and will be removed in 2.0. Use \Twig\TwigFilter instead.', E_USER_DEPRECATED); 15 16/** 17 * Represents a method template filter. 18 * 19 * Use \Twig\TwigFilter instead. 20 * 21 * @author Fabien Potencier <fabien@symfony.com> 22 * 23 * @deprecated since 1.12 (to be removed in 2.0) 24 */ 25class Twig_Filter_Method extends Twig_Filter 26{ 27 protected $extension; 28 protected $method; 29 30 public function __construct(ExtensionInterface $extension, $method, array $options = []) 31 { 32 $options['callable'] = [$extension, $method]; 33 34 parent::__construct($options); 35 36 $this->extension = $extension; 37 $this->method = $method; 38 } 39 40 public function compile() 41 { 42 return sprintf('$this->env->getExtension(\'%s\')->%s', \get_class($this->extension), $this->method); 43 } 44} 45