Code Duplication    Length = 23-26 lines in 2 locations

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() : bool
71
    {

src/Tokens/Elements/Audio.php 1 location

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