Code Duplication    Length = 20-31 lines in 3 locations

src/Tokens/Elements/Iframe.php 1 location

@@ 17-42 (lines=26) @@
14
 *
15
 * https://html.spec.whatwg.org/multipage/semantics.html#the-iframe-element
16
 */
17
class Iframe extends OpenElement implements FlowContent, PhrasingContent, EmbeddedContent, InteractiveContent
18
{
19
    protected function getAllowedAttributes()
20
    {
21
        $iframeAllowedAttributes = array(
22
            '/^src$/i' => Attribute::URI,
23
            '/^srcdoc$/i' => Attribute::CS_STRING,
24
            '/^name$/i' => Attribute::CS_STRING,
25
            '/^sandbox$/i' => Attribute::CS_STRING,
26
            '/^allowfullscreen$/i' => Attribute::CS_STRING,
27
            '/^width$/i' => Attribute::INT,
28
            '/^height$/i' => Attribute::INT,
29
            '/^referrerpolicy$/i' => Attribute::CS_STRING,
30
        );
31
32
        return array_merge(
33
            $iframeAllowedAttributes,
34
            parent::getAllowedAttributes()
35
        );
36
    }
37
38
    public function isInteractiveContent()
39
    {
40
        return true;
41
    }
42
}
43

src/Tokens/Elements/Object.php 1 location

@@ 17-47 (lines=31) @@
14
 *
15
 * https://html.spec.whatwg.org/multipage/semantics.html#the-object-element
16
 */
17
class Object extends OpenElement implements FlowContent, PhrasingContent, EmbeddedContent, InteractiveContent
18
{
19
    protected function getAllowedAttributes()
20
    {
21
        $objectAllowedAttributes = array(
22
            '/^data$/i' => Attribute::CS_STRING,
23
            '/^type$/i' => Attribute::CS_STRING,
24
            '/^typemustmatch$/i' => Attribute::CS_STRING,
25
            '/^name$/i' => Attribute::CS_STRING,
26
            '/^usemap$/i' => Attribute::CS_STRING,
27
            '/^form$/i' => Attribute::CS_STRING,
28
            '/^width$/i' => Attribute::INT,
29
            '/^height$/i' => Attribute::INT
30
        );
31
32
        return array_merge(
33
            $objectAllowedAttributes,
34
            parent::getAllowedAttributes()
35
        );
36
    }
37
38
    public function isInteractiveContent()
39
    {
40
        return true;
41
    }
42
43
    public function isTransparentElement()
44
    {
45
        return true;
46
    }
47
}
48

src/Tokens/Elements/Script.php 1 location

@@ 12-31 (lines=20) @@
9
use Groundskeeper\Tokens\ElementTypes\PhrasingContent;
10
use Groundskeeper\Tokens\ElementTypes\ScriptSupporting;
11
12
class Script extends OpenElement implements FlowContent, MetadataContent, PhrasingContent, ScriptSupporting
13
{
14
    protected function getAllowedAttributes()
15
    {
16
        $scriptAllowedAttributes = array(
17
            '/^src$/i' => Attribute::URI,
18
            '/^type$/i' => Attribute::CS_STRING,
19
            '/^charset$/i' => Attribute::CS_STRING,
20
            '/^async$/i' => Attribute::BOOL,
21
            '/^defer$/i' => Attribute::BOOL,
22
            '/^crossorigin$/i' => Attribute::CS_STRING,
23
            '/^nonce$/i' => Attribute::CS_STRING
24
        );
25
26
        return array_merge(
27
            $scriptAllowedAttributes,
28
            parent::getAllowedAttributes()
29
        );
30
    }
31
}
32