Script::getAllowedAttributes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 12

Duplication

Lines 17
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 17
loc 17
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 12
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Groundskeeper\Tokens\Elements;
4
5
use Groundskeeper\Tokens\Attribute;
6
use Groundskeeper\Tokens\ElementTypes\FlowContent;
7
use Groundskeeper\Tokens\ElementTypes\MetadataContent;
8
use Groundskeeper\Tokens\ElementTypes\OpenElement;
9
use Groundskeeper\Tokens\ElementTypes\PhrasingContent;
10
use Groundskeeper\Tokens\ElementTypes\ScriptSupporting;
11
12 View Code Duplication
class Script extends OpenElement implements FlowContent, MetadataContent, PhrasingContent, ScriptSupporting
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14 1
    protected function getAllowedAttributes()
15
    {
16
        $scriptAllowedAttributes = array(
17 1
            '/^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 1
        return array_merge(
27 1
            $scriptAllowedAttributes,
28 1
            parent::getAllowedAttributes()
29
        );
30
    }
31
}
32