Code Duplication    Length = 15-16 lines in 2 locations

src/Tokens/Elements/A.php 1 location

@@ 52-67 (lines=16) @@
49
        }
50
    }
51
52
    protected function removeInvalidChildren(LoggerInterface $logger)
53
    {
54
        // There must be no interactive content or "a" element descendants.
55
        foreach ($this->children as $child) {
56
            if ($child->getType() == Token::COMMENT) {
57
                continue;
58
            }
59
60
            if ($child->getType() == Token::ELEMENT &&
61
                ($child->getName() == 'a' ||
62
                 ($child instanceof InteractiveContent && $child->isInteractiveContent()))) {
63
                $logger->debug('Removing ' . $child . '. Element "a" cannot contain "a" or interactive content elements.');
64
                $this->removeChild($child);
65
            }
66
        }
67
    }
68
69
    protected function removeInvalidSelf(LoggerInterface $logger)
70
    {

src/Tokens/Elements/Dfn.php 1 location

@@ 19-33 (lines=15) @@
16
 */
17
class Dfn extends OpenElement implements FlowContent, PhrasingContent, InlineElement
18
{
19
    protected function removeInvalidChildren(LoggerInterface $logger)
20
    {
21
        // There must be no dfn element descendants.
22
        foreach ($this->children as $child) {
23
            if ($child->getType() == Token::COMMENT) {
24
                continue;
25
            }
26
27
            if ($child->getType() == Token::ELEMENT &&
28
                $child->getName() == 'dfn') {
29
                $logger->debug('Removing ' . $child . '. Element "dfn" cannot contain "dfn" elements.');
30
                $this->removeChild($child);
31
            }
32
        }
33
    }
34
35
    protected function removeInvalidSelf(LoggerInterface $logger)
36
    {