Code Duplication    Length = 14-16 lines in 3 locations

src/Tokens/Elements/Option.php 1 location

@@ 76-89 (lines=14) @@
73
        }
74
    }
75
76
    protected function removeInvalidSelf(LoggerInterface $logger)
77
    {
78
        $parent = $this->getParent();
79
        if ($parent !== null &&
80
            !$parent instanceof Select &&
81
            !$parent instanceof Datalist &&
82
            !$parent instanceof Optgroup) {
83
            $logger->debug('Removing ' . $this . '. Only "select", "datalist", and "optgroup" elements allowed as parents of "option" element.');
84
85
            return true;
86
        }
87
88
        return false;
89
    }
90
}
91

src/Tokens/Elements/Source.php 1 location

@@ 33-47 (lines=15) @@
30
        );
31
    }
32
33
    protected function removeInvalidSelf(LoggerInterface $logger)
34
    {
35
        // Child of "picture" element.
36
        // Child of media element.
37
        $parent = $this->getParent();
38
        if ($parent !== null &&
39
            !$parent instanceof Picture &&
40
            !$parent instanceof MediaElement) {
41
            $logger->debug('Removing ' . $this . ' must be a child of "picture" element or a media element.');
42
43
            return true;
44
        }
45
46
        return false;
47
    }
48
}
49

src/Tokens/Elements/Tr.php 1 location

@@ 33-48 (lines=16) @@
30
        }
31
    }
32
33
    protected function removeInvalidSelf(LoggerInterface $logger)
34
    {
35
        // "table" must be parent.
36
        $parent = $this->getParent();
37
        if ($parent !== null &&
38
            !$parent instanceof Thead &&
39
            !$parent instanceof Tbody &&
40
            !$parent instanceof Tfoot &&
41
            !$parent instanceof Table) {
42
            $logger->debug('Removing ' . $this . '. Must be a child of the "thead", "tbody", "tfoot", or "table" elements.');
43
44
            return true;
45
        }
46
47
        return false;
48
    }
49
}
50