Completed
Push — master ( d8e3ee...0777f1 )
by Kevin
03:18
created

Header::removeInvalidSelf()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 15
Code Lines 10

Duplication

Lines 15
Ratio 100 %

Code Coverage

Tests 10
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 15
loc 15
ccs 10
cts 10
cp 1
rs 9.2
cc 4
eloc 10
nc 2
nop 1
crap 4
1
<?php
2
3
namespace Groundskeeper\Tokens\Elements;
4
5
use Groundskeeper\Tokens\ElementTypes\FlowContent;
6
use Groundskeeper\Tokens\ElementTypes\OpenElement;
7
use Psr\Log\LoggerInterface;
8
9
/**
10
 * "header" element
11
 */
12 View Code Duplication
class Header extends OpenElement implements FlowContent
0 ignored issues
show
Duplication introduced by
This class 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...
13
{
14 2
    protected function removeInvalidSelf(LoggerInterface $logger)
15
    {
16 2
        $footer = new Footer($this->configuration, 'footer');
17 2
        $header = new self($this->configuration, 'header');
18 2
        $main = new Main($this->configuration, 'main');
19 2
        if ($this->hasAncestor($footer) ||
20 1
            $this->hasAncestor($header) ||
21 2
            $this->hasAncestor($main)) {
22 2
            $logger->debug('Removing ' . $this . '. Element "header" should not be a descendant of "footer", "header", or "main" elements.');
23
24 2
            return true;
25
        }
26
27 1
        return false;
28
    }
29
}
30