* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * * @author Fabien Potencier */ class SecurityExtension extends \Twig_Extension { protected $context; public function __construct(SecurityContext $context = null) { $this->context = $context; } public function getContext() { return $this->context; } /** * {@inheritdoc} */ public function getFilters() { return array( ); } /** * {@inheritdoc} */ public function getTokenParsers() { return array( // {% ifrole "ROLE_ADMIN" %}something{% endifrole %} new IfRoleTokenParser(), ); } /** * Returns the name of the extension. * * @return string The extension name */ public function getName() { return 'security'; } }