Code Duplication    Length = 23-26 lines in 2 locations

src/Tokens/Elements/Audio.php 1 location

@@ 42-67 (lines=26) @@
39
        );
40
    }
41
42
    protected function removeInvalidChildren(LoggerInterface $logger)
43
    {
44
        $hasSrc = $this->hasAttribute('src');
45
        foreach ($this->children as $child) {
46
            if ($child instanceof NonParticipanting ||
47
                $child instanceof Text) {
48
                continue;
49
            }
50
51
            if (!$hasSrc && $child instanceof Source) {
52
                continue;
53
            }
54
55
            if ($child instanceof Track) {
56
                continue;
57
            }
58
59
            if ($child instanceof TransparentElement &&
60
                $child->isTransparentElement()) {
61
                continue;
62
            }
63
64
            $logger->debug('Removing ' . $child . '. Only text, "source", "track", and transparent elements allowed as children of "audio" element.');
65
            $this->removeChild($child);
66
        }
67
    }
68
69
    public function isInteractiveContent()
70
    {

src/Tokens/Elements/Video.php 1 location

@@ 46-68 (lines=23) @@
43
        );
44
    }
45
46
    protected function removeInvalidChildren(LoggerInterface $logger)
47
    {
48
        $hasSrc = $this->hasAttribute('src');
49
        foreach ($this->children as $child) {
50
            if ($child instanceof NonParticipating ||
51
                $child instanceof Text ||
52
                $child instanceof Track) {
53
                continue;
54
            }
55
56
            if (!$hasSrc && $child instanceof Source) {
57
                continue;
58
            }
59
60
            if ($child instanceof TransparentElement &&
61
                $child->isTransparentElement()) {
62
                continue;
63
            }
64
65
            $logger->debug('Removing ' . $child . '. Only "source", "track", and transparent elements allowed as children of "video" element.');
66
            $this->removeChild($child);
67
        }
68
    }
69
70
    public function isInteractiveContent()
71
    {