Completed
Branch dev-master (5a9550)
by Derek Stephen
02:00
created

FormRenderer::getAction()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 1
b 0
f 0
cc 2
eloc 2
nc 2
nop 1
crap 2
1
<?php
2
/**
3
 * User: delboy1978uk
4
 * Date: 29/11/2016
5
 * Time: 19:44
6
 */
7
8
namespace Del\Form\Renderer;
9
10
use DOMElement;
11
12
class FormRenderer extends AbstractFormRenderer implements FormRendererInterface
13
{
14
    /**
15
     * @return DOMElement
16
     */
17 5
    public function renderFieldLabel()
18
    {
19 5
        $label = $this->dom->createElement('label');
20 5
        $label->setAttribute('for', $this->field->getId());
21 5
        $label->textContent = $this->field->getLabel();
22 5
        return $label;
23
    }
24
25
    /**
26
     * @return DOMElement
27
     */
28 5
    public function renderFieldBlock()
29
    {
30 5
        $formGroup = $this->block;
31 5
        $class = $formGroup->getAttribute('class');
32 5
        $formGroup->setAttribute('class', $class.'form-group');
33 5
        $formGroup->appendChild($this->label);
34 5
        $formGroup->appendChild($this->element);
35 5
        if (!is_null($this->errors)) {
36 2
            $formGroup->appendChild($this->errors);
37
        }
38 5
        return $formGroup;
39
    }
40
41
}