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

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