| Conditions | 47 |
| Paths | 1632 |
| Total Lines | 95 |
| Code Lines | 58 |
| 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 |
||
| 75 | public function block_item($context, array $blocks = []) |
||
| 76 | { |
||
| 77 | $macros = $this->macros; |
||
| 78 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"]; |
||
| 79 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "item")); |
||
| 80 | |||
| 81 | // line 8 |
||
| 82 | echo " "; |
||
| 83 | $context["path"] = ((twig_get_attribute($this->env, $this->source, (isset($context["entry"]) || array_key_exists("entry", $context) ? $context["entry"] : (function () { throw new RuntimeError('Variable "entry" does not exist.', 8, $this->source); })()), "routeParameters", [], "any", false, false, false, 8)) ? ($this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath(twig_get_attribute($this->env, $this->source, (isset($context["entry"]) || array_key_exists("entry", $context) ? $context["entry"] : (function () { throw new RuntimeError('Variable "entry" does not exist.', 8, $this->source); })()), "routeName", [], "any", false, false, false, 8), twig_get_attribute($this->env, $this->source, (isset($context["entry"]) || array_key_exists("entry", $context) ? $context["entry"] : (function () { throw new RuntimeError('Variable "entry" does not exist.', 8, $this->source); })()), "routeParameters", [], "any", false, false, false, 8))) : ($this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath(twig_get_attribute($this->env, $this->source, (isset($context["entry"]) || array_key_exists("entry", $context) ? $context["entry"] : (function () { throw new RuntimeError('Variable "entry" does not exist.', 8, $this->source); })()), "routeName", [], "any", false, false, false, 8)))); |
||
| 84 | // line 9 |
||
| 85 | echo " "; |
||
| 86 | $context["label"] = twig_get_attribute($this->env, $this->source, (isset($context["entry"]) || array_key_exists("entry", $context) ? $context["entry"] : (function () { throw new RuntimeError('Variable "entry" does not exist.', 9, $this->source); })()), "label", [], "any", false, false, false, 9); |
||
| 87 | // line 10 |
||
| 88 | echo " "; |
||
| 89 | $context["handle"] = twig_lower_filter($this->env, (isset($context["label"]) || array_key_exists("label", $context) ? $context["label"] : (function () { throw new RuntimeError('Variable "label" does not exist.', 10, $this->source); })())); |
||
| 90 | // line 11 |
||
| 91 | echo " "; |
||
| 92 | $context["selectedSubnavItem"] = ((array_key_exists("selectedSubnavItem", $context)) ? (_twig_default_filter((isset($context["selectedSubnavItem"]) || array_key_exists("selectedSubnavItem", $context) ? $context["selectedSubnavItem"] : (function () { throw new RuntimeError('Variable "selectedSubnavItem" does not exist.', 11, $this->source); })()), null)) : (null)); |
||
| 93 | // line 12 |
||
| 94 | echo " |
||
| 95 | "; |
||
| 96 | // line 13 |
||
| 97 | $context["current"] = (((isset($context["selectedSubnavItem"]) || array_key_exists("selectedSubnavItem", $context) ? $context["selectedSubnavItem"] : (function () { throw new RuntimeError('Variable "selectedSubnavItem" does not exist.', 13, $this->source); })()) === (isset($context["handle"]) || array_key_exists("handle", $context) ? $context["handle"] : (function () { throw new RuntimeError('Variable "handle" does not exist.', 13, $this->source); })())) || twig_get_attribute($this->env, $this->source, (isset($context["entry"]) || array_key_exists("entry", $context) ? $context["entry"] : (function () { throw new RuntimeError('Variable "entry" does not exist.', 13, $this->source); })()), "current", [], "any", false, false, false, 13)); |
||
| 98 | // line 14 |
||
| 99 | echo " "; |
||
| 100 | $context["inActiveTrail"] = twig_get_attribute($this->env, $this->source, (isset($context["entry"]) || array_key_exists("entry", $context) ? $context["entry"] : (function () { throw new RuntimeError('Variable "entry" does not exist.', 14, $this->source); })()), "inActiveTrail", [], "any", false, false, false, 14); |
||
| 101 | // line 15 |
||
| 102 | echo " |
||
| 103 | <a href=\""; |
||
| 104 | // line 16 |
||
| 105 | echo twig_escape_filter($this->env, (isset($context["path"]) || array_key_exists("path", $context) ? $context["path"] : (function () { throw new RuntimeError('Variable "path" does not exist.', 16, $this->source); })()), "html", null, true); |
||
| 106 | echo "\" |
||
| 107 | "; |
||
| 108 | // line 17 |
||
| 109 | if (((isset($context["current"]) || array_key_exists("current", $context) ? $context["current"] : (function () { throw new RuntimeError('Variable "current" does not exist.', 17, $this->source); })()) || (isset($context["inActiveTrail"]) || array_key_exists("inActiveTrail", $context) ? $context["inActiveTrail"] : (function () { throw new RuntimeError('Variable "inActiveTrail" does not exist.', 17, $this->source); })()))) { |
||
| 110 | echo "class=\"active "; |
||
| 111 | echo (((isset($context["current"]) || array_key_exists("current", $context) ? $context["current"] : (function () { throw new RuntimeError('Variable "current" does not exist.', 17, $this->source); })())) ? ("current") : ("")); |
||
| 112 | echo "\""; |
||
| 113 | } |
||
| 114 | // line 18 |
||
| 115 | echo " > |
||
| 116 | |||
| 117 | <span>"; |
||
| 118 | // line 20 |
||
| 119 | echo twig_escape_filter($this->env, (isset($context["label"]) || array_key_exists("label", $context) ? $context["label"] : (function () { throw new RuntimeError('Variable "label" does not exist.', 20, $this->source); })()), "html", null, true); |
||
| 120 | echo "</span> |
||
| 121 | "; |
||
| 122 | // line 21 |
||
| 123 | if ( !twig_test_empty(twig_get_attribute($this->env, $this->source, (isset($context["entry"]) || array_key_exists("entry", $context) ? $context["entry"] : (function () { throw new RuntimeError('Variable "entry" does not exist.', 21, $this->source); })()), "children", [], "any", false, false, false, 21))) { |
||
| 124 | // line 22 |
||
| 125 | echo " "; |
||
| 126 | echo twig_source($this->env, "@Menu/svg/caret.svg"); |
||
| 127 | echo " |
||
| 128 | "; |
||
| 129 | } |
||
| 130 | // line 24 |
||
| 131 | echo " </a> |
||
| 132 | |||
| 133 | "; |
||
| 134 | // line 26 |
||
| 135 | $context['_parent'] = $context; |
||
| 136 | $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, $context["entry"], "children", [], "any", false, false, false, 26)); |
||
| 137 | $context['loop'] = [ |
||
| 138 | 'parent' => $context['_parent'], |
||
| 139 | 'index0' => 0, |
||
| 140 | 'index' => 1, |
||
| 141 | 'first' => true, |
||
| 142 | ]; |
||
| 143 | if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) { |
||
| 144 | $length = count($context['_seq']); |
||
| 145 | $context['loop']['revindex0'] = $length - 1; |
||
| 146 | $context['loop']['revindex'] = $length; |
||
| 147 | $context['loop']['length'] = $length; |
||
| 148 | $context['loop']['last'] = 1 === $length; |
||
| 149 | } |
||
| 150 | foreach ($context['_seq'] as $context["_key"] => $context["entry"]) { |
||
| 151 | // line 27 |
||
| 152 | echo " "; |
||
| 153 | $this->displayBlock("menu", $context, $blocks); |
||
| 154 | echo " |
||
| 155 | "; |
||
| 156 | ++$context['loop']['index0']; |
||
| 157 | ++$context['loop']['index']; |
||
| 158 | $context['loop']['first'] = false; |
||
| 159 | if (isset($context['loop']['length'])) { |
||
| 160 | --$context['loop']['revindex0']; |
||
| 161 | --$context['loop']['revindex']; |
||
| 162 | $context['loop']['last'] = 0 === $context['loop']['revindex0']; |
||
| 163 | } |
||
| 164 | } |
||
| 165 | $_parent = $context['_parent']; |
||
| 166 | unset($context['_seq'], $context['_iterated'], $context['_key'], $context['entry'], $context['_parent'], $context['loop']); |
||
| 167 | $context = array_intersect_key($context, $_parent) + $_parent; |
||
| 168 | |||
| 169 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof); |
||
| 170 | |||
| 216 |