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.
Passed
Push — master ( 99c051...63fac8 )
by Mewes
18:46
created

MacroContextNodeVisitor   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 5
dl 0
loc 41
ccs 0
cts 19
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getPriority() 0 4 1
A doEnterNode() 0 19 2
A doLeaveNode() 0 4 1
1
<?php
2
3
namespace MewesK\TwigSpreadsheetBundle\Twig\NodeVisitor;
4
5
use MewesK\TwigSpreadsheetBundle\Wrapper\PhpSpreadsheetWrapper;
6
7
/**
8
 * Class MacroContextNodeVisitor.
9
 */
10
class MacroContextNodeVisitor extends \Twig_BaseNodeVisitor
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function getPriority()
16
    {
17
        return 0;
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    protected function doEnterNode(\Twig_Node $node, \Twig_Environment $env)
24
    {
25
        // add wrapper instance as argument on all method calls
26
        if ($node instanceof \Twig_Node_Expression_MethodCall) {
27
            $keyNode = new \Twig_Node_Expression_Constant(PhpSpreadsheetWrapper::INSTANCE_KEY, $node->getTemplateLine());
28
29
            // add wrapper even if it not exists, we fix that later
30
            $valueNode = new \Twig_Node_Expression_Name(PhpSpreadsheetWrapper::INSTANCE_KEY, $node->getTemplateLine());
31
            $valueNode->setAttribute('ignore_strict_check', true);
32
33
            /**
34
             * @var \Twig_Node_Expression_Array $argumentsNode
35
             */
36
            $argumentsNode = $node->getNode('arguments');
37
            $argumentsNode->addElement($valueNode, $keyNode);
38
        }
39
40
        return $node;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    protected function doLeaveNode(\Twig_Node $node, \Twig_Environment $env)
47
    {
48
        return $node;
49
    }
50
}
51