DebugExtension::setBreakpoint()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Del\Twig;
4
5
use Twig_Environment;
6
use Twig_Extension;
7
use Twig_SimpleFunction;
8
9
class DebugExtension extends Twig_Extension
10
{
11
    /**
12
     * @return string
13
     */
14 1
    public function getName() 
15
    {
16 1
        return 'breakpoint';
17
    }
18
19
    /**
20
     * @return array
21
     */
22 1
    public function getFunctions()
23
    {
24
        return array(
25 1
            new Twig_SimpleFunction('breakpoint', [$this, 'setBreakpoint'], ['needs_environment' => true, 'needs_context' => true]),
26
        );
27
    }
28
29
    /**
30
     * pause the code!
31
     * @param Twig_Environment $environment
32
     * @param $context
33
     */
34 1
    public function setBreakpoint(Twig_Environment $environment, $context)
0 ignored issues
show
Unused Code introduced by
The parameter $environment is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $context is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
    {
36 1
        if (function_exists('xdebug_break')) {
37 1
            xdebug_break();
38
        }
39 1
    }
40
}
41