Code Duplication    Length = 20-20 lines in 2 locations

src/Tokens/Elements/Footer.php 1 location

@@ 13-32 (lines=20) @@
10
/**
11
 * "footer" element
12
 */
13
class Footer extends OpenElement implements FlowContent
14
{
15
    protected function doClean(LoggerInterface $logger)
16
    {
17
        if ($this->configuration->get('clean-strategy') != Configuration::CLEAN_STRATEGY_LENIENT) {
18
            $footer = new self($this->configuration, 'footer');
19
            $header = new Header($this->configuration, 'header');
20
            $main = new Main($this->configuration, 'main');
21
            if ($this->hasAncestor($footer) ||
22
                $this->hasAncestor($header) ||
23
                $this->hasAncestor($main)) {
24
                $logger->debug('Removing ' . $this . '. Element "footer" should not be a descendant of "footer", "header", or "main" elements.');
25
26
                return false;
27
            }
28
        }
29
30
        return true;
31
    }
32
}
33

src/Tokens/Elements/Header.php 1 location

@@ 13-32 (lines=20) @@
10
/**
11
 * "header" element
12
 */
13
class Header extends OpenElement implements FlowContent
14
{
15
    protected function doClean(LoggerInterface $logger)
16
    {
17
        if ($this->configuration->get('clean-strategy') != Configuration::CLEAN_STRATEGY_LENIENT) {
18
            $footer = new Footer($this->configuration, 'footer');
19
            $header = new self($this->configuration, 'header');
20
            $main = new Main($this->configuration, 'main');
21
            if ($this->hasAncestor($footer) ||
22
                $this->hasAncestor($header) ||
23
                $this->hasAncestor($main)) {
24
                $logger->debug('Removing ' . $this . '. Element "header" should not be a descendant of "footer", "header", or "main" elements.');
25
26
                return false;
27
            }
28
        }
29
30
        return true;
31
    }
32
}
33