Code Duplication    Length = 12-13 lines in 2 locations

src/Tokens/Elements/Body.php 1 location

@@ 44-55 (lines=12) @@
41
        );
42
    }
43
44
    protected function removeInvalidSelf(LoggerInterface $logger)
45
    {
46
        // "body" element must be a child of "html" element.
47
        if ($this->getParent() !== null &&
48
            !($this->getParent() instanceof Html)) {
49
            $logger->debug('Removing ' . $this . '. Must be a child of "html" element.');
50
51
            return true;
52
        }
53
54
        return false;
55
    }
56
}
57

src/Tokens/Elements/Meta.php 1 location

@@ 38-50 (lines=13) @@
35
        }
36
    }
37
38
    protected function removeInvalidSelf(LoggerInterface $logger)
39
    {
40
        // If "charset" attribute is present, the must be child of "head" element.
41
        if ($this->hasAttribute('charset') && $this->getParent() !== null) {
42
            if (!$this->getParent() instanceof Head) {
43
                $logger->debug('Removing ' . $this . '. Element "meta" with a "charset" attribute must be a "head" element child.');
44
45
                return true;
46
            }
47
        }
48
49
        return false;
50
    }
51
}
52