Completed
Pull Request — master (#1)
by Derek Stephen
02:21
created

RadioRender   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 21
loc 21
ccs 5
cts 6
cp 0.8333
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A renderFieldBlock() 9 9 2

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
 * User: delboy1978uk
4
 * Date: 04/12/2016
5
 * Time: 22:33
6
 */
7
8
namespace Del\Form\Renderer\Field;
9
10
use Del\Form\Field\FieldInterface;
11
use DOMElement;
12
13 View Code Duplication
class RadioRender extends AbstractFieldRender implements FieldRendererInterface
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...
14
{
15
    /**
16
     * @param FieldInterface $field
17
     * @param DOMElement $fieldBlock
18
     * @param DOMElement $labelBlock
19
     * @param DOMElement $element
20
     * @param DOMElement|null $errorBlock
21
     * @return DOMElement
22
     */
23 1
    public function renderFieldBlock(FieldInterface $field, DOMElement $fieldBlock, DOMElement $labelBlock, DOMElement $element, DOMElement $errorBlock = null)
24
    {
25 1
        $labelBlock->appendChild($element);
26 1
        $fieldBlock->appendChild($labelBlock);
27 1
        if ($errorBlock) {
28
            $fieldBlock->appendChild($errorBlock);
29
        }
30 1
        return $fieldBlock;
31
    }
32
33
}