Completed
Push — master ( 0490e0...5154b1 )
by Kevin
03:30
created

Fieldset   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAllowedAttributes() 13 13 1
A fixSelf() 6 6 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\FlowContent;
7
use Groundskeeper\Tokens\ElementTypes\OpenElement;
8
use Groundskeeper\Tokens\ElementTypes\SectioningRoot;
9
use Psr\Log\LoggerInterface;
10
11
/**
12
 * "fieldset" element
13
 *
14
 * https://html.spec.whatwg.org/multipage/forms.html#the-fieldset-element
15
 */
16 View Code Duplication
class Fieldset extends OpenElement implements FlowContent, SectioningRoot
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...
17
{
18 1
    protected function getAllowedAttributes()
19
    {
20
        $fieldsetAllowedAttributes = array(
21 1
            '/^disabled$/i' => Attribute::BOOL,
22 1
            '/^form$/i' => Attribute::CS_STRING,
23
            '/^name$/i' => Attribute::CS_STRING
24 1
        );
25
26 1
        return array_merge(
27 1
            $fieldsetAllowedAttributes,
28 1
            parent::getAllowedAttributes()
29 1
        );
30
    }
31
32 1
    protected function fixSelf(LoggerInterface $logger)
33
    {
34
        // If "legend" element is present, then it must be the first
35
        // child of "fieldset" element.
36
        /// @todo
37 1
    }
38
}
39