| Conditions | 5 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 5.0113 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 8 | function __invoke(array $contexts, $padding = 0) |
|
|
|
|||
| 21 | { |
||
| 22 | 8 | $output = sprintf('<ul class="nav nav-pills nav-stacked"%s>', $padding==0?' id="magium-contexts"':''); |
|
| 23 | 8 | foreach ($contexts as $context) { |
|
| 24 | 8 | $output .= sprintf( |
|
| 25 | '<li |
||
| 26 | class="magium-context magium-requires-cursor" |
||
| 27 | data-context="%s" |
||
| 28 | id="magium-context-%s" |
||
| 29 | 8 | style="padding-left: %spx; "><a>%s</a>', |
|
| 30 | 8 | htmlspecialchars($context['id']), |
|
| 31 | 8 | htmlspecialchars($context['id']), |
|
| 32 | $padding, |
||
| 33 | 8 | htmlspecialchars($context['label']) |
|
| 34 | ); |
||
| 35 | 8 | if (isset($context['children']) && count($context['children'])) { |
|
| 36 | $output .= $this($context['children'], $padding + 10); |
||
| 37 | } |
||
| 38 | 8 | $output .= '</li>'; |
|
| 39 | } |
||
| 40 | 8 | $output .= '</ul>'; |
|
| 41 | 8 | 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.