Code Duplication    Length = 7-7 lines in 3 locations

src/Tokens/Elements/Body.php 1 location

@@ 42-48 (lines=7) @@
39
    protected function doClean(LoggerInterface $logger)
40
    {
41
        // "body" element must be a child of "html" element.
42
        if ($this->getParent() !== null &&
43
            $this->getParent()->getType() === Token::ELEMENT &&
44
            $this->getParent()->getName() != 'html') {
45
            $logger->debug('Element "body" must be a child of "html" element.');
46
47
            return false;
48
        }
49
50
        return true;
51
    }

src/Tokens/Elements/Head.php 1 location

@@ 19-25 (lines=7) @@
16
    protected function doClean(LoggerInterface $logger)
17
    {
18
        // "head" element must be a child of "html" element.
19
        if ($this->getParent() !== null &&
20
            $this->getParent()->getType() === Token::ELEMENT &&
21
            $this->getParent()->getName() != 'html') {
22
            $logger->debug('Element "head" must be a child of "html" element.');
23
24
            return false;
25
        }
26
27
        // "head" element must contain only metadata content elements.
28
        // "head" element must contain exactly one "title" element.

src/Tokens/Elements/Meta.php 1 location

@@ 31-37 (lines=7) @@
28
    protected function doClean(LoggerInterface $logger)
29
    {
30
        // If "charset" attribute is present, the must be child of "head" element.
31
        if ($this->hasAttribute('charset') && $this->getParent() !== null) {
32
            if ($this->getParent()->getType() !== Token::ELEMENT || $this->getParent()->getName() != 'head') {
33
                $logger->debug('Element "meta" with a "charset" attribute must be a "head" element child.');
34
35
                return false;
36
            }
37
        }
38
39
        return true;
40
    }