Total Complexity | 59 |
Total Lines | 198 |
Duplicated Lines | 0 % |
Changes | 0 |
Complex classes like __TwigTemplate_cb72583f1f22b21397b6fc8b4d9b91994a04ee9aa55bdfa5613296f92a168536 often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use __TwigTemplate_cb72583f1f22b21397b6fc8b4d9b91994a04ee9aa55bdfa5613296f92a168536, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
16 | class __TwigTemplate_cb72583f1f22b21397b6fc8b4d9b91994a04ee9aa55bdfa5613296f92a168536 extends Template |
||
17 | { |
||
18 | private $source; |
||
19 | private $macros = []; |
||
20 | |||
21 | public function __construct(Environment $env) |
||
22 | { |
||
23 | parent::__construct($env); |
||
24 | |||
25 | $this->source = $this->getSourceContext(); |
||
26 | |||
27 | $this->parent = false; |
||
28 | |||
29 | $this->blocks = [ |
||
30 | 'menu' => [$this, 'block_menu'], |
||
31 | 'item' => [$this, 'block_item'], |
||
32 | ]; |
||
33 | } |
||
34 | |||
35 | protected function doDisplay(array $context, array $blocks = []) |
||
36 | { |
||
37 | $macros = $this->macros; |
||
|
|||
38 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"]; |
||
39 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "@Menu/breadcrumb_menu_blocks.html.twig")); |
||
40 | |||
41 | // line 1 |
||
42 | $this->displayBlock('menu', $context, $blocks); |
||
43 | // line 6 |
||
44 | echo " |
||
45 | "; |
||
46 | // line 7 |
||
47 | $this->displayBlock('item', $context, $blocks); |
||
48 | |||
49 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof); |
||
50 | |||
51 | } |
||
52 | |||
53 | // line 1 |
||
54 | public function block_menu($context, array $blocks = []) |
||
55 | { |
||
56 | $macros = $this->macros; |
||
57 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"]; |
||
58 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "menu")); |
||
59 | |||
60 | // line 2 |
||
61 | echo " "; |
||
62 | if ((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.', 2, $this->source); })()), "inActiveTrail", [], "any", false, false, false, 2) || 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.', 2, $this->source); })()), "current", [], "any", false, false, false, 2))) { |
||
63 | // line 3 |
||
64 | echo " "; |
||
65 | $this->displayBlock("item", $context, $blocks); |
||
66 | echo " |
||
67 | "; |
||
68 | } |
||
69 | |||
70 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof); |
||
71 | |||
72 | } |
||
73 | |||
74 | // line 7 |
||
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 | |||
171 | } |
||
172 | |||
173 | public function getTemplateName() |
||
174 | { |
||
175 | return "@Menu/breadcrumb_menu_blocks.html.twig"; |
||
176 | } |
||
177 | |||
178 | public function getDebugInfo() |
||
181 | } |
||
182 | |||
183 | public function getSourceContext() |
||
214 | } |
||
215 | } |
||
216 |