4 * AJGL Breakpoint Twig Extension Component
6 * Copyright (C) Antonio J. García Lagar <aj@garcialagar.es>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Ajgl\Twig\Extension;
18 * @author Antonio J. García Lagar <aj@garcialagar.es>
20 class BreakpointExtension extends Twig_Extension
22 public function getName()
27 public function getFunctions()
30 new \Twig_SimpleFunction('breakpoint', array($this, 'setBreakpoint'), array('needs_environment' => true, 'needs_context' => true)),
35 * If XDebug is detected, makes the debugger break.
37 * @param Twig_Environment $environment the environment instance
38 * @param mixed $context variables from the Twig template
40 public function setBreakpoint(Twig_Environment $environment, $context)
42 if (function_exists('xdebug_break')) {
43 $arguments = array_slice(func_get_args(), 2);