Code Duplication    Length = 20-20 lines in 3 locations

src/Tokens/Elements/Footer.php 1 location

@@ 12-31 (lines=20) @@
9
/**
10
 * "footer" element
11
 */
12
class Footer extends OpenElement implements FlowContent
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 "footer" should not be a descendant of "footer", "header", or "main" elements.');
24
            }
25
26
            return false;
27
        }
28
29
        return true;
30
    }
31
}
32

src/Tokens/Elements/Header.php 1 location

@@ 12-31 (lines=20) @@
9
/**
10
 * "header" element
11
 */
12
class Header extends OpenElement implements FlowContent
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

src/Tokens/Elements/Main.php 1 location

@@ 12-31 (lines=20) @@
9
/**
10
 * "main" element
11
 */
12
class Main extends OpenElement implements FlowContent
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 "main" should not be a descendant of "footer", "header", or "main" elements.');
24
            }
25
26
            return false;
27
        }
28
29
        return true;
30
    }
31
}
32