Added the Search API Synonym module to deal specifically with licence and license...
[yaffs-website] / vendor / ajgl / breakpoint-twig-extension / src / BreakpointExtension.php
1 <?php
2
3 /*
4  * AJGL Breakpoint Twig Extension Component
5  *
6  * Copyright (C) Antonio J. García Lagar <aj@garcialagar.es>
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 namespace Ajgl\Twig\Extension;
13
14 use Twig_Environment;
15 use Twig_Extension;
16
17 /**
18  * @author Antonio J. García Lagar <aj@garcialagar.es>
19  */
20 class BreakpointExtension extends Twig_Extension
21 {
22     public function getName()
23     {
24         return 'breakpoint';
25     }
26
27     public function getFunctions()
28     {
29         return array(
30             new \Twig_SimpleFunction('breakpoint', array($this, 'setBreakpoint'), array('needs_environment' => true, 'needs_context' => true)),
31         );
32     }
33
34     /**
35      * If XDebug is detected, makes the debugger break.
36      *
37      * @param Twig_Environment $environment the environment instance
38      * @param mixed            $context     variables from the Twig template
39      */
40     public function setBreakpoint(Twig_Environment $environment, $context)
41     {
42         if (function_exists('xdebug_break')) {
43             $arguments = array_slice(func_get_args(), 2);
44             xdebug_break();
45         }
46     }
47 }