Nip_Form_Renderer_Paragraph   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
eloc 22
c 1
b 0
f 0
dl 0
loc 44
ccs 0
cts 24
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A renderElements() 0 10 2
A renderRow() 0 19 4
A renderRows() 0 9 2
1
<?php
2
3
use Nip\Form\Renderer\AbstractRenderer;
4
5
class Nip_Form_Renderer_Paragraph extends AbstractRenderer
6
{
7
    public function renderElements()
8
    {
9
        $return = '';
10
11
        $renderRows = $this->renderRows();
12
        if ($renderRows) {
13
            $return .= $renderRows;
14
        }
15
16
        return $return;
17
    }
18
19
    public function renderRows()
20
    {
21
        $elements = $this->getElements();
22
        $return = '';
23
        foreach ($elements as $element) {
24
            $return .= $this->renderRow($element);
25
        }
26
27
        return $return;
28
    }
29
30
    public function renderRow($element)
31
    {
32
        $return = '';
33
        if (!$element->isRendered()) {
34
            $return .= '<p class="row row-' . $element->getUniqueId() . ($element->isError() ? ' error' : '') . '">';
35
36
            $return .= $this->renderLabel($element);
0 ignored issues
show
Deprecated Code introduced by
The function Nip\Form\Renderer\AbstractRenderer::renderLabel() has been deprecated: Use renderElementLabel() ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

36
            $return .= /** @scrutinizer ignore-deprecated */ $this->renderLabel($element);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
37
38
            $class = "value " . ($element->getType() == 'input' ? 'input' : '');
39
            $return .= '<span class="' . $class . '">';
40
            $return .= $element->renderElement();
41
            $return .= '</span>';
42
43
            $return .= $element->renderErrors();
44
45
            $return .= '</p>';
46
        }
47
48
        return $return;
49
    }
50
}
51