Code Duplication    Length = 20-21 lines in 2 locations

src/Tokens/Elements/Img.php 1 location

@@ 16-35 (lines=20) @@
13
 */
14
class Img extends ClosedElement
15
{
16
    protected function getAllowedAttributes()
17
    {
18
        $imgAllowedAttributes = array(
19
            '/^alt$/i' => Element::ATTR_CS_STRING,
20
            '/^src$/i' => Element::ATTR_URI,
21
            '/^srcset$/i' => Element::ATTR_CS_STRING,
22
            '/^sizes$/i' => Element::ATTR_CS_STRING,
23
            '/^crossorigin$/i' => Element::ATTR_CS_STRING,
24
            '/^usemap$/i' => Element::ATTR_CS_STRING,
25
            '/^ismap$/i' => Element::ATTR_CS_STRING,
26
            '/^width$/i' => Element::ATTR_INT,
27
            '/^height$/i' => Element::ATTR_INT,
28
            '/^referrerpolicy$/i' => Element::ATTR_CS_STRING,
29
        );
30
31
        return array_merge(
32
            $imgAllowedAttributes,
33
            parent::getAllowedAttributes()
34
        );
35
    }
36
}
37

src/Tokens/Elements/Video.php 1 location

@@ 23-43 (lines=21) @@
20
 */
21
class Video extends OpenElement implements FlowContent, PhrasingContent, EmbeddedContent, InteractiveContent, TransparentElement
22
{
23
    protected function getAllowedAttributes()
24
    {
25
        $videoAllowedAttributes = array(
26
            '/^src$/i' => Element::ATTR_URI,
27
            '/^crossorigin$/i' => Element::ATTR_CS_STRING,
28
            '/^poster$/i' => Element::ATTR_URI,
29
            '/^preload$/i' => Element::ATTR_CI_ENUM . '("","none","metadata","auto"|"")',
30
            '/^autoplay$/i' => Element::ATTR_BOOL,
31
            '/^mediagroup$/i' => Element::ATTR_CS_STRING,
32
            '/^loop$/i' => Element::ATTR_BOOL,
33
            '/^muted$/i' => Element::ATTR_BOOL,
34
            '/^controls$/i' => Element::ATTR_BOOL,
35
            '/^width$/i' => Element::ATTR_INT,
36
            '/^height$/i' => Element::ATTR_INT
37
        );
38
39
        return array_merge(
40
            $videoAllowedAttributes,
41
            parent::getAllowedAttributes()
42
        );
43
    }
44
45
    protected function removeInvalidChildren(LoggerInterface $logger)
46
    {