Code Duplication    Length = 13-15 lines in 4 locations

src/Tokens/Elements/Dl.php 1 location

@@ 18-32 (lines=15) @@
15
 */
16
class Dl extends OpenElement implements FlowContent
17
{
18
    protected function removeInvalidChildren(LoggerInterface $logger)
19
    {
20
        // Only "dd", "dt", and ScriptSupporting elements allowed.
21
        foreach ($this->children as $child) {
22
            if ($child instanceof NonParticipating ||
23
                $child instanceof Dd ||
24
                $child instanceof Dt ||
25
                $child instanceof ScriptSupporting) {
26
                continue;
27
            }
28
29
            $logger->debug('Removing ' . $child . '. Only elements "dd", "dt", and script supporting elements allowed as children of "dl" element.');
30
            $this->removeChild($child);
31
        }
32
    }
33
}
34

src/Tokens/Elements/Dt.php 1 location

@@ 17-29 (lines=13) @@
14
 */
15
class Dt extends OpenElement
16
{
17
    protected function removeInvalidChildren(LoggerInterface $logger)
18
    {
19
        // No "header", "footer", sectioning content, or heading content descendants.
20
        foreach ($this->children as $child) {
21
            if ($child instanceof Header ||
22
                $child instanceof Footer ||
23
                $child instanceof SectioningContent ||
24
                $child instanceof HeadingContent) {
25
                $logger->debug('Removing ' . $child . '. No "header", "footer", and sectioning content, or heading content elements allowed as children of "dt" element.');
26
                $this->removeChild($child);
27
            }
28
        }
29
    }
30
31
    protected function removeInvalidSelf(LoggerInterface $logger) : bool
32
    {

src/Tokens/Elements/Tr.php 1 location

@@ 17-31 (lines=15) @@
14
 */
15
class Tr extends OpenElement
16
{
17
    protected function removeInvalidChildren(LoggerInterface $logger)
18
    {
19
        // Children can be "td", "th", and script supporting elements.
20
        foreach ($this->children as $child) {
21
            if ($child instanceof NonParticipating ||
22
                $child instanceof Td ||
23
                $child instanceof Th ||
24
                $child instanceof ScriptSupporting) {
25
                continue;
26
            }
27
28
            $logger->debug('Removing ' . $child . '. Only "td", "th", and script supporting elements allowed as children of "tr" element.');
29
            $this->removeChild($child);
30
        }
31
    }
32
33
    protected function removeInvalidSelf(LoggerInterface $logger) : bool
34
    {

src/Tokens/Elements/Select.php 1 location

@@ 40-53 (lines=14) @@
37
        );
38
    }
39
40
    protected function removeInvalidChildren(LoggerInterface $logger)
41
    {
42
        foreach ($this->children as $child) {
43
            if ($child instanceof NonParticipating ||
44
                $child instanceof Option ||
45
                $child instanceof Optgroup ||
46
                $child instanceof ScriptSupporting) {
47
                continue;
48
            }
49
50
            $logger->debug('Removing ' . $child . '. Only "option, "optgroup", and script supporting elements allowed as children of a "select" element.');
51
            $this->removeChild($child);
52
        }
53
    }
54
55
    public function isInteractiveContent() : bool
56
    {