Conditions | 5 |
Paths | 3 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 5.009 |
Changes | 0 |
1 | <?php |
||
20 | 9 | function __invoke(array $contexts, $padding = 0) |
|
|
|||
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 | |||
46 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.