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 ( 82ab4e...5bf5e4 )
by Mewes
06:05 queued 02:02
created

HeaderFooterNode   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 25 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 13
loc 52
ccs 18
cts 18
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A compile() 13 13 1
A getAllowedParents() 0 6 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace MewesK\TwigSpreadsheetBundle\Twig\Node;
4
5
use MewesK\TwigSpreadsheetBundle\Wrapper\HeaderFooterWrapper;
6
7
/**
8
 * Class HeaderFooterNode.
9
 */
10
class HeaderFooterNode extends BaseNode
11
{
12
    /**
13
     * @var string
14
     */
15
    private $baseType;
16
17
    /**
18
     * HeaderFooterNode constructor.
19
     *
20
     * @param array       $nodes
21
     * @param array       $attributes
22
     * @param int         $lineNo
23
     * @param string|null $tag
24
     * @param string      $baseType
25
     *
26
     * @throws \InvalidArgumentException
27
     */
28 3
    public function __construct(array $nodes = [], array $attributes = [], int $lineNo = 0, string $tag = null, string $baseType = HeaderFooterWrapper::BASETYPE_HEADER)
29
    {
30 3
        parent::__construct($nodes, $attributes, $lineNo, $tag);
31
32 3
        $this->baseType = HeaderFooterWrapper::validateBaseType(strtolower($baseType));
33 3
    }
34
35
    /**
36
     * @param \Twig_Compiler $compiler
37
     */
38 3 View Code Duplication
    public function compile(\Twig_Compiler $compiler)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
    {
40 3
        $compiler->addDebugInfo($this)
41 3
            ->write(self::CODE_FIX_CONTEXT)
42 3
            ->write(self::CODE_INSTANCE.'->startHeaderFooter(')
43 3
                ->repr($this->baseType)->raw(', ')
44 3
                ->subcompile($this->getNode('type'))->raw(', ')
45 3
                ->subcompile($this->getNode('properties'))
46 3
            ->raw(');'.PHP_EOL)
47 3
            ->subcompile($this->getNode('body'))
48 3
            ->addDebugInfo($this)
49 3
            ->write(self::CODE_INSTANCE.'->endHeaderFooter();'.PHP_EOL);
50 3
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55 3
    public function getAllowedParents(): array
56
    {
57
        return [
58 3
            SheetNode::class,
59
        ];
60
    }
61
}
62