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

TextRender   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 21
loc 21
ccs 6
cts 6
cp 1
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: 21:08
6
 */
7
8
namespace Del\Form\Renderer\Field;
9
10
use Del\Form\Field\FieldInterface;
11
use DOMDocument;
12
use DOMElement;
13
14 View Code Duplication
class TextRender 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...
15
{
16
    /**
17
     * @param FieldInterface $field
18
     * @param DOMElement $fieldBlock
19
     * @param DOMElement $labelBlock
20
     * @param DOMElement $element
21
     * @param DOMElement|null $errorBlock
22
     * @return DOMElement
23
     */
24 4
    public function renderFieldBlock(FieldInterface $field, DOMElement $fieldBlock, DOMElement $labelBlock, DOMElement $element, DOMElement $errorBlock = null)
25
    {
26 4
        $fieldBlock->appendChild($labelBlock);
27 4
        $fieldBlock->appendChild($element);
28 4
        if ($errorBlock) {
29 2
            $fieldBlock->appendChild($errorBlock);
30
        }
31 4
        return $fieldBlock;
32
    }
33
34
}