DebugExtension   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 32
ccs 8
cts 8
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A getFunctions() 0 6 1
A setBreakpoint() 0 6 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