Completed
Push — master ( 91ab9a...64950e )
by Kevin
04:15
created

Iframe   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 87.5%

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 2
c 2
b 1
f 1
lcom 0
cbo 1
dl 26
loc 26
ccs 14
cts 16
cp 0.875
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAllowedAttributes() 18 18 1
A isInteractiveContent() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Groundskeeper\Tokens\Elements;
4
5
use Groundskeeper\Tokens\Attribute;
6
use Groundskeeper\Tokens\ElementTypes\EmbeddedContent;
7
use Groundskeeper\Tokens\ElementTypes\FlowContent;
8
use Groundskeeper\Tokens\ElementTypes\InteractiveContent;
9
use Groundskeeper\Tokens\ElementTypes\OpenElement;
10
use Groundskeeper\Tokens\ElementTypes\PhrasingContent;
11
12
/**
13
 * "iframe" element
14
 *
15
 * https://html.spec.whatwg.org/multipage/semantics.html#the-iframe-element
16
 */
17 View Code Duplication
class Iframe extends OpenElement implements FlowContent, PhrasingContent, EmbeddedContent, InteractiveContent
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...
18
{
19 1
    protected function getAllowedAttributes()
20
    {
21
        $iframeAllowedAttributes = array(
22 1
            '/^src$/i' => Attribute::URI,
23 1
            '/^srcdoc$/i' => Attribute::CS_STRING,
24 1
            '/^name$/i' => Attribute::CS_STRING,
25 1
            '/^sandbox$/i' => Attribute::CS_STRING,
26 1
            '/^allowfullscreen$/i' => Attribute::CS_STRING,
27 1
            '/^width$/i' => Attribute::INT,
28 1
            '/^height$/i' => Attribute::INT,
29 1
            '/^referrerpolicy$/i' => Attribute::CS_STRING,
30 1
        );
31
32 1
        return array_merge(
33 1
            $iframeAllowedAttributes,
34 1
            parent::getAllowedAttributes()
35 1
        );
36
    }
37
38
    public function isInteractiveContent()
39
    {
40
        return true;
41
    }
42
}
43