Code Duplication    Length = 20-22 lines in 3 locations

src/Tokens/Elements/Img.php 1 location

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

src/Tokens/Elements/Video.php 1 location

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

src/Tokens/Elements/Button.php 1 location

@@ 20-41 (lines=22) @@
17
 */
18
class Button extends OpenElement implements FlowContent, InteractiveContent, PhrasingContent
19
{
20
    protected function getAllowedAttributes()
21
    {
22
        $buttonAllowedAttributes = array(
23
            '/^autofocus$/i' => Attribute::BOOL,
24
            '/^disabled$/i' => Attribute::BOOL,
25
            '/^form$/i' => Attribute::CS_STRING,
26
            '/^formaction$/i' => Attribute::URI,
27
            '/^formenctype$/i' => Attribute::CS_STRING,
28
            '/^formmethod$/i' => Attribute::CI_ENUM . '("","get","post","dialog"|"get")',
29
            '/^formnovalidate$/i' => Attribute::BOOL,
30
            '/^formtarget$/i' => Attribute::CS_STRING,
31
            '/^menu$/i' => Attribute::CS_STRING,
32
            '/^name$/i' => Attribute::CS_STRING,
33
            '/^type$/i' => Attribute::CI_ENUM . '("submit","reset","button","menu"|"submit")',
34
            '/^value$/i' => Attribute::CS_STRING
35
        );
36
37
        return array_merge(
38
            $buttonAllowedAttributes,
39
            parent::getAllowedAttributes()
40
        );
41
    }
42
43
    protected function removeInvalidChildren(LoggerInterface $logger)
44
    {