| Conditions | 11 |
| Paths | 12 |
| Total Lines | 62 |
| Code Lines | 42 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 45 | protected function doDisplay(array $context, array $blocks = []) |
||
| 46 | { |
||
| 47 | $macros = $this->macros; |
||
|
|
|||
| 48 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"]; |
||
| 49 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "@Menu/menu.html.twig")); |
||
| 50 | |||
| 51 | // line 2 |
||
| 52 | echo " |
||
| 53 | <nav> |
||
| 54 | "; |
||
| 55 | // line 4 |
||
| 56 | $context['_parent'] = $context; |
||
| 57 | $context['_seq'] = twig_ensure_traversable((isset($context["menus"]) || array_key_exists("menus", $context) ? $context["menus"] : (function () { throw new RuntimeError('Variable "menus" does not exist.', 4, $this->source); })())); |
||
| 58 | $context['loop'] = [ |
||
| 59 | 'parent' => $context['_parent'], |
||
| 60 | 'index0' => 0, |
||
| 61 | 'index' => 1, |
||
| 62 | 'first' => true, |
||
| 63 | ]; |
||
| 64 | if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) { |
||
| 65 | $length = count($context['_seq']); |
||
| 66 | $context['loop']['revindex0'] = $length - 1; |
||
| 67 | $context['loop']['revindex'] = $length; |
||
| 68 | $context['loop']['length'] = $length; |
||
| 69 | $context['loop']['last'] = 1 === $length; |
||
| 70 | } |
||
| 71 | foreach ($context['_seq'] as $context["_key"] => $context["entry"]) { |
||
| 72 | echo " "; |
||
| 73 | $this->displayBlock("menu", $context, $blocks); |
||
| 74 | echo " "; |
||
| 75 | ++$context['loop']['index0']; |
||
| 76 | ++$context['loop']['index']; |
||
| 77 | $context['loop']['first'] = false; |
||
| 78 | if (isset($context['loop']['length'])) { |
||
| 79 | --$context['loop']['revindex0']; |
||
| 80 | --$context['loop']['revindex']; |
||
| 81 | $context['loop']['last'] = 0 === $context['loop']['revindex0']; |
||
| 82 | } |
||
| 83 | } |
||
| 84 | $_parent = $context['_parent']; |
||
| 85 | unset($context['_seq'], $context['_iterated'], $context['_key'], $context['entry'], $context['_parent'], $context['loop']); |
||
| 86 | $context = array_intersect_key($context, $_parent) + $_parent; |
||
| 87 | // line 5 |
||
| 88 | echo "</nav> |
||
| 89 | "; |
||
| 90 | // line 6 |
||
| 91 | $context["items"] = call_user_func_array($this->env->getFunction('menu_result')->getCallable(), [$context, "main_menu"]); |
||
| 92 | // line 7 |
||
| 93 | echo " |
||
| 94 | "; |
||
| 95 | // line 8 |
||
| 96 | $context['_parent'] = $context; |
||
| 97 | $context['_seq'] = twig_ensure_traversable((isset($context["items"]) || array_key_exists("items", $context) ? $context["items"] : (function () { throw new RuntimeError('Variable "items" does not exist.', 8, $this->source); })())); |
||
| 98 | foreach ($context['_seq'] as $context["_key"] => $context["item"]) { |
||
| 99 | // line 9 |
||
| 100 | echo " "; |
||
| 101 | } |
||
| 102 | $_parent = $context['_parent']; |
||
| 103 | unset($context['_seq'], $context['_iterated'], $context['_key'], $context['item'], $context['_parent'], $context['loop']); |
||
| 104 | $context = array_intersect_key($context, $_parent) + $_parent; |
||
| 105 | |||
| 106 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof); |
||
| 107 | |||
| 139 |