Completed
Push — master ( e0ac7a...8eddfc )
by Kevin
03:21
created

Embed   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 63.64 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAllowedAttributes() 14 14 1
A isInteractiveContent() 0 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\ElementTypes\ClosedElement;
6
use Groundskeeper\Tokens\ElementTypes\EmbeddedContent;
7
use Groundskeeper\Tokens\ElementTypes\FlowContent;
8
use Groundskeeper\Tokens\ElementTypes\InteractiveContent;
9
use Groundskeeper\Tokens\ElementTypes\PhrasingContent;
10
11
/**
12
 * "embed" element
13
 *
14
 * https://html.spec.whatwg.org/multipage/semantics.html#the-embed-element
15
 */
16
class Embed extends ClosedElement implements FlowContent, PhrasingContent, EmbeddedContent, InteractiveContent
17
{
18 View Code Duplication
    protected function getAllowedAttributes()
0 ignored issues
show
Duplication introduced by
This method 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...
19
    {
20
        $embedAllowedAttributes = array(
21
            '/^src$/i' => Element::ATTR_URI,
22
            '/^type$/i' => Element::ATTR_CS_STRING,
23
            '/^name$/i' => Element::ATTR_CS_STRING,
24
            '/^[a-z_-]$/i' => Element::ATTR_CS_STRING,
25
        );
26
27
        return array_merge(
28
            $embedAllowedAttributes,
29
            parent::getAllowedAttributes()
30
        );
31
    }
32
33
    public function isInteractiveContent()
34
    {
35
        return true;
36
    }
37
}
38