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/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
    {

src/Tokens/Elements/Video.php 1 location

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