Code Duplication    Length = 18-18 lines in 2 locations

src/Tokens/Elements/Footer.php 1 location

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

src/Tokens/Elements/Header.php 1 location

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