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.

ScrambleVariable::enterNode()   B
last analyzed

Complexity

Conditions 6
Paths 4

Size

Total Lines 17
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 17
rs 8.8571
cc 6
eloc 7
nc 4
nop 1
1
<?php
2
/**
3
 * ScrambleVariable.php
4
 *
5
 * @category        Naneau
6
 * @package         Obfuscator
7
 * @subpackage      NodeVisitor
8
 */
9
10
namespace Naneau\Obfuscator\Node\Visitor;
11
12
use Naneau\Obfuscator\Node\Visitor\Scrambler as ScramblerVisitor;
13
use Naneau\Obfuscator\StringScrambler;
14
15
use PhpParser\NodeVisitorAbstract;
16
use PhpParser\Node;
17
use PhpParser\Node\Stmt;
18
use PhpParser\Node\Param;
19
use PhpParser\Node\Stmt\StaticVar;
20
use PhpParser\Node\Expr\Variable;
21
use PhpParser\Node\Stmt\Catch_ as CatchStatement;
22
use PhpParser\Node\Expr\ClosureUse;
23
24
use \InvalidArgumentException;
25
26
/**
27
 * ScrambleVariable
28
 *
29
 * Renames parameters
30
 *
31
 * @category        Naneau
32
 * @package         Obfuscator
33
 * @subpackage      NodeVisitor
34
 */
35
class ScrambleVariable extends ScramblerVisitor
36
{
37
    /**
38
     * Constructor
39
     *
40
     * @param  StringScrambler $scrambler
41
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
42
     **/
43
    public function __construct(StringScrambler $scrambler)
44
    {
45
        parent::__construct($scrambler);
46
47
        $this->setIgnore(array(
48
            'this', '_SERVER', '_POST', '_GET', '_REQUEST', '_COOKIE',
49
            '_SESSION', '_ENV', '_FILES'
50
        ));
51
    }
52
53
    /**
54
     * Check all variable nodes
55
     *
56
     * @param  Node $node
57
     * @return void
58
     **/
59
    public function enterNode(Node $node)
60
    {
61
        // Function param or variable use
62
        if ($node instanceof Param || $node instanceof StaticVar || $node instanceof Variable) {
63
            return $this->scramble($node);
64
        }
65
66
        // try {} catch () {}
67
        if ($node instanceof CatchStatement) {
68
            return $this->scramble($node, 'var');
69
        }
70
71
        // Function() use ($x, $y) {}
72
        if ($node instanceof ClosureUse) {
73
            return $this->scramble($node, 'var');
74
        }
75
    }
76
}
77