Code Duplication    Length = 12-13 lines in 2 locations

src/Tokens/Elements/Body.php 1 location

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

src/Tokens/Elements/Meta.php 1 location

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