MagiumRecursiveContextRenderer   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 92.86%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 28
ccs 13
cts 14
cp 0.9286
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 23 5
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: kschr
5
 * Date: 3/20/2017
6
 * Time: 4:54 PM
7
 */
8
9
namespace Magium\Configuration\View;
10
11
use Zend\Form\Element;
12
use Zend\Form\ElementInterface;
13
use Zend\Form\View\Helper\FormElement;
14
use Zend\Form\View\Helper\FormInput;
15
use Zend\Form\View\Helper\FormSelect;
16
use Zend\View\Helper\AbstractHelper;
17
18
class MagiumRecursiveContextRenderer extends AbstractHelper
19
{
20 9
    function __invoke(array $contexts, $padding = 0)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
21
    {
22 9
        $output = sprintf('<ul class="nav nav-pills nav-stacked"%s>', $padding==0?' id="magium-contexts"':'');
23 9
        foreach ($contexts as $context) {
24 9
            $output .= sprintf(
25 9
                '<li
26
                            class="magium-context magium-requires-cursor"
27
                            data-context="%s"
28
                            id="magium-context-%s"
29
                            style="padding-left: %spx; "><a>%s</a>',
30 9
                    htmlspecialchars($context['id']),
31 9
                    htmlspecialchars($context['id']),
32 9
                    $padding,
33 9
                    htmlspecialchars($context['label'])
34
            );
35 9
            if (isset($context['children']) && count($context['children'])) {
36
                $output .= $this($context['children'], $padding + 10);
37
            }
38 9
            $output .= '</li>';
39
        }
40 9
        $output .= '</ul>';
41 9
        return $output;
42
    }
43
44
45
}
46