GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

BreakpointExtension::getFunctions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * AJGL Breakpoint Twig Extension Component
5
 *
6
 * Copyright (C) Antonio J. García Lagar <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ajgl\Twig\Extension;
13
14
use Twig_Environment;
15
use Twig_Extension;
16
17
/**
18
 * @author Antonio J. García Lagar <[email protected]>
19
 */
20
class BreakpointExtension extends Twig_Extension
21
{
22 1
    public function getName()
23
    {
24 1
        return 'breakpoint';
25
    }
26
27 1
    public function getFunctions()
28
    {
29
        return array(
30 1
            new \Twig_SimpleFunction('breakpoint', array($this, 'setBreakpoint'), array('needs_environment' => true, 'needs_context' => true)),
31 1
        );
32
    }
33
34
    /**
35
     * If XDebug is detected, makes the debugger break.
36
     *
37
     * @param Twig_Environment $environment the environment instance
38
     * @param mixed            $context     variables from the Twig template
39
     */
40
    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...
41
    {
42
        if (function_exists('xdebug_break')) {
43
            $arguments = array_slice(func_get_args(), 2);
1 ignored issue
show
Unused Code introduced by
$arguments is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
44
            xdebug_break();
45
        }
46
    }
47
}
48