Completed
Push — master ( de651d...518fd1 )
by Derek Stephen
01:03
created

DebugExtension   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

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() : string
15
    {
16 1
        return 'breakpoint';
17
    }
18
19 1
    public function getFunctions() : array
20
    {
21
        return array(
22 1
            new Twig_SimpleFunction('breakpoint', [$this, 'setBreakpoint'], ['needs_environment' => true, 'needs_context' => true]),
23
        );
24
    }
25
26
    /**
27
     * pause the code!
28
     */
29 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...
30
    {
31 1
        if (function_exists('xdebug_break')) {
32 1
            xdebug_break();
33
        }
34 1
    }
35
}
36