Completed
Push — master ( 1ec99b...a17ead )
by Kevin
02:44
created

Header::doClean()   B

Complexity

Conditions 5
Paths 3

Size

Total Lines 17
Code Lines 11

Duplication

Lines 17
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 30

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 17
loc 17
ccs 0
cts 15
cp 0
rs 8.8571
cc 5
eloc 11
nc 3
nop 1
crap 30
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
    protected function doClean(LoggerInterface $logger = null)
15
    {
16
        $footer = new Footer($this->configuration, 'footer');
17
        $header = new Header($this->configuration, 'header');
18
        $main = new Main($this->configuration, 'main');
19
        if ($this->hasAncestor($footer) ||
20
            $this->hasAncestor($header) ||
21
            $this->hasAncestor($main)) {
22
            if ($logger !== null) {
23
                $logger->debug('Removing ' . $this . '. Element "header" should not be a descendant of "footer", "header", or "main" elements.');
24
            }
25
26
            return false;
27
        }
28
29
        return true;
30
    }
31
}
32