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.
Test Setup Failed
Push — master ( 78f8b7...0f754d )
by Elemér
04:15
created

HeaderFooterTokenParser   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 6
dl 0
loc 57
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A configureParameters() 0 13 1
A createNode() 0 4 1
A getTag() 0 4 1
1
<?php
2
3
namespace Erelke\TwigSpreadsheetBundle\Twig\TokenParser;
4
5
use Erelke\TwigSpreadsheetBundle\Twig\Node\HeaderFooterNode;
6
use Erelke\TwigSpreadsheetBundle\Wrapper\HeaderFooterWrapper;
7
use InvalidArgumentException;
8
use Twig\Node\Expression\ArrayExpression as Twig_Node_Expression_Array;
9
use Twig\Node\Expression\ConstantExpression as Twig_Node_Expression_Constant;
10
use Twig\Token as Twig_Token;
11
use Twig\Node\Node as Twig_Node;
12
13
/**
14
 * Class HeaderFooterTokenParser.
15
 */
16
class HeaderFooterTokenParser extends BaseTokenParser
17
{
18
    /**
19
     * @var string
20
     */
21
    private $baseType;
22
23
    /**
24
     * HeaderFooterTokenParser constructor.
25
     *
26
     * @param array  $attributes optional attributes for the corresponding node
27
     * @param string $baseType
28
     *
29
     * @throws InvalidArgumentException
30
     */
31
    public function __construct(array $attributes = [], string $baseType = HeaderFooterWrapper::BASETYPE_HEADER)
32
    {
33
        parent::__construct($attributes);
34
35
        $this->baseType = HeaderFooterWrapper::validateBaseType(strtolower($baseType));
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function configureParameters(Twig_Token $token): array
42
    {
43
        return [
44
            'type' => [
45
                'type' => self::PARAMETER_TYPE_VALUE,
46
                'default' => new Twig_Node_Expression_Constant(null, $token->getLine()),
47
            ],
48
            'properties' => [
49
                'type' => self::PARAMETER_TYPE_ARRAY,
50
                'default' => new Twig_Node_Expression_Array([], $token->getLine()),
51
            ],
52
        ];
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     *
58
     * @throws InvalidArgumentException
59
     */
60
    public function createNode(array $nodes = [], int $lineNo = 0): Twig_Node
61
    {
62
        return new HeaderFooterNode($nodes, $this->getAttributes(), $lineNo, $this->getTag(), $this->baseType);
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68
    public function getTag()
69
    {
70
        return 'xls'.$this->baseType;
71
    }
72
}
73