Code Duplication    Length = 23-26 lines in 2 locations

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

src/Tokens/Elements/Video.php 1 location

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