HiddenField   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 64.71 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 11
loc 17
c 0
b 0
f 0
wmc 1
lcom 0
cbo 3
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A renderInput() 11 11 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 mindplay\kissform\Fields;
4
5
use mindplay\kissform\InputModel;
6
use mindplay\kissform\InputRenderer;
7
8
/**
9
 * This class represents an <input type="hidden"> element
10
 */
11
class HiddenField extends TextField
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 1 View Code Duplication
    public function renderInput(InputRenderer $renderer, InputModel $model, array $attr)
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...
17
    {
18 1
        return $renderer->tag(
19 1
            'input',
20
            $attr + [
21 1
                'type' => 'hidden',
22 1
                'name' => $renderer->getName($this),
23 1
                'value' => $model->getInput($this),
24
            ]
25
        );
26
    }
27
}
28