Code Duplication    Length = 20-21 lines in 2 locations

src/Tokens/Elements/Video.php 1 location

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

src/Tokens/Elements/Img.php 1 location

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