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

DebugExtension::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
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