Total Complexity | 69 |
Total Lines | 339 |
Duplicated Lines | 0 % |
Changes | 0 |
Complex classes like __TwigTemplate_098b712e456ffb4abe16e26acf026bf39dbc0c4dc8ae59c0eef8706b32b55aee 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_098b712e456ffb4abe16e26acf026bf39dbc0c4dc8ae59c0eef8706b32b55aee, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
16 | class __TwigTemplate_098b712e456ffb4abe16e26acf026bf39dbc0c4dc8ae59c0eef8706b32b55aee 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 | 'item' => [$this, 'block_item'], |
||
31 | 'menu' => [$this, 'block_menu'], |
||
32 | 'section' => [$this, 'block_section'], |
||
33 | 'system' => [$this, 'block_system'], |
||
34 | 'icon' => [$this, 'block_icon'], |
||
35 | ]; |
||
36 | } |
||
37 | |||
38 | protected function doDisplay(array $context, array $blocks = []) |
||
39 | { |
||
40 | $macros = $this->macros; |
||
|
|||
41 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"]; |
||
42 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "@Menu/menu_blocks.html.twig")); |
||
43 | |||
44 | // line 1 |
||
45 | $this->displayBlock('item', $context, $blocks); |
||
46 | // line 18 |
||
47 | echo " |
||
48 | "; |
||
49 | // line 19 |
||
50 | $this->displayBlock('menu', $context, $blocks); |
||
51 | // line 32 |
||
52 | echo " |
||
53 | "; |
||
54 | // line 33 |
||
55 | $this->displayBlock('section', $context, $blocks); |
||
56 | // line 42 |
||
57 | echo " |
||
58 | "; |
||
59 | // line 43 |
||
60 | $this->displayBlock('system', $context, $blocks); |
||
61 | // line 48 |
||
62 | echo " |
||
63 | "; |
||
64 | // line 49 |
||
65 | $this->displayBlock('icon', $context, $blocks); |
||
66 | // line 56 |
||
67 | echo " |
||
68 | |||
69 | |||
70 | |||
71 | "; |
||
72 | |||
73 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof); |
||
74 | |||
75 | } |
||
76 | |||
77 | // line 1 |
||
78 | public function block_item($context, array $blocks = []) |
||
79 | { |
||
80 | $macros = $this->macros; |
||
81 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"]; |
||
82 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "item")); |
||
83 | |||
84 | // line 2 |
||
85 | echo " "; |
||
86 | $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.', 2, $this->source); })()), "routeParameters", [], "any", false, false, false, 2)) ? ($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.', 2, $this->source); })()), "routeName", [], "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); })()), "routeParameters", [], "any", false, false, false, 2))) : ($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.', 2, $this->source); })()), "routeName", [], "any", false, false, false, 2)))); |
||
87 | // line 3 |
||
88 | echo " "; |
||
89 | $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.', 3, $this->source); })()), "label", [], "any", false, false, false, 3); |
||
90 | // line 4 |
||
91 | echo " "; |
||
92 | $context["icon"] = 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.', 4, $this->source); })()), "icon", [], "any", false, false, false, 4); |
||
93 | // line 5 |
||
94 | echo " "; |
||
95 | $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.', 5, $this->source); })())); |
||
96 | // line 6 |
||
97 | echo " "; |
||
98 | $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.', 6, $this->source); })()), null)) : (null)); |
||
99 | // line 7 |
||
100 | echo " |
||
101 | "; |
||
102 | // line 8 |
||
103 | $context["current"] = (((isset($context["selectedSubnavItem"]) || array_key_exists("selectedSubnavItem", $context) ? $context["selectedSubnavItem"] : (function () { throw new RuntimeError('Variable "selectedSubnavItem" does not exist.', 8, $this->source); })()) === (isset($context["handle"]) || array_key_exists("handle", $context) ? $context["handle"] : (function () { throw new RuntimeError('Variable "handle" does not exist.', 8, $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.', 8, $this->source); })()), "current", [], "any", false, false, false, 8)); |
||
104 | // line 9 |
||
105 | echo " "; |
||
106 | $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.', 9, $this->source); })()), "inActiveTrail", [], "any", false, false, false, 9); |
||
107 | // line 10 |
||
108 | echo " |
||
109 | <a href=\""; |
||
110 | // line 11 |
||
111 | 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.', 11, $this->source); })()), "html", null, true); |
||
112 | echo "\" |
||
113 | "; |
||
114 | // line 12 |
||
115 | if (((isset($context["current"]) || array_key_exists("current", $context) ? $context["current"] : (function () { throw new RuntimeError('Variable "current" does not exist.', 12, $this->source); })()) || (isset($context["inActiveTrail"]) || array_key_exists("inActiveTrail", $context) ? $context["inActiveTrail"] : (function () { throw new RuntimeError('Variable "inActiveTrail" does not exist.', 12, $this->source); })()))) { |
||
116 | echo "class=\"active "; |
||
117 | echo (((isset($context["current"]) || array_key_exists("current", $context) ? $context["current"] : (function () { throw new RuntimeError('Variable "current" does not exist.', 12, $this->source); })())) ? ("underline") : ("")); |
||
118 | echo "\""; |
||
119 | } |
||
120 | // line 13 |
||
121 | echo " > |
||
122 | "; |
||
123 | // line 14 |
||
124 | $this->displayBlock("icon", $context, $blocks); |
||
125 | echo " |
||
126 | "; |
||
127 | // line 15 |
||
128 | 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.', 15, $this->source); })()), "html", null, true); |
||
129 | echo " |
||
130 | </a> |
||
131 | "; |
||
132 | |||
133 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof); |
||
134 | |||
135 | } |
||
136 | |||
137 | // line 19 |
||
138 | public function block_menu($context, array $blocks = []) |
||
139 | { |
||
140 | $macros = $this->macros; |
||
141 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"]; |
||
142 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "menu")); |
||
143 | |||
144 | // line 20 |
||
145 | echo " "; |
||
146 | 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.', 20, $this->source); })()), "type", [], "any", false, false, false, 20) === twig_constant("Braunstetter\\MenuBundle\\Items\\MenuItem::TYPE_SYSTEM"))) { |
||
147 | // line 21 |
||
148 | echo " "; |
||
149 | $this->displayBlock("system", $context, $blocks); |
||
150 | echo " |
||
151 | "; |
||
152 | } |
||
153 | // line 23 |
||
154 | echo " |
||
155 | "; |
||
156 | // line 24 |
||
157 | 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.', 24, $this->source); })()), "type", [], "any", false, false, false, 24) === twig_constant("Braunstetter\\MenuBundle\\Items\\MenuItem::TYPE_SECTION"))) { |
||
158 | // line 25 |
||
159 | echo " "; |
||
160 | $this->displayBlock("section", $context, $blocks); |
||
161 | echo " |
||
162 | "; |
||
163 | } |
||
164 | // line 27 |
||
165 | echo " |
||
166 | "; |
||
167 | // line 28 |
||
168 | 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.', 28, $this->source); })()), "type", [], "any", false, false, false, 28) === twig_constant("Braunstetter\\MenuBundle\\Items\\MenuItem::TYPE_ROUTE"))) { |
||
169 | // line 29 |
||
170 | echo " "; |
||
171 | $this->displayBlock("item", $context, $blocks); |
||
172 | echo " |
||
173 | "; |
||
174 | } |
||
175 | |||
176 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof); |
||
177 | |||
178 | } |
||
179 | |||
180 | // line 33 |
||
181 | public function block_section($context, array $blocks = []) |
||
182 | { |
||
183 | $macros = $this->macros; |
||
184 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"]; |
||
185 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "section")); |
||
186 | |||
187 | // line 34 |
||
188 | echo " "; |
||
189 | $this->displayBlock("item", $context, $blocks); |
||
190 | echo " |
||
191 | |||
192 | <div class=\"section\"> |
||
193 | "; |
||
194 | // line 37 |
||
195 | $context['_parent'] = $context; |
||
196 | $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, $context["entry"], "children", [], "any", false, false, false, 37)); |
||
197 | $context['loop'] = [ |
||
198 | 'parent' => $context['_parent'], |
||
199 | 'index0' => 0, |
||
200 | 'index' => 1, |
||
201 | 'first' => true, |
||
202 | ]; |
||
203 | if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) { |
||
204 | $length = count($context['_seq']); |
||
205 | $context['loop']['revindex0'] = $length - 1; |
||
206 | $context['loop']['revindex'] = $length; |
||
207 | $context['loop']['length'] = $length; |
||
208 | $context['loop']['last'] = 1 === $length; |
||
209 | } |
||
210 | foreach ($context['_seq'] as $context["_key"] => $context["entry"]) { |
||
211 | // line 38 |
||
212 | echo " "; |
||
213 | $this->displayBlock("menu", $context, $blocks); |
||
214 | echo " |
||
215 | "; |
||
216 | ++$context['loop']['index0']; |
||
217 | ++$context['loop']['index']; |
||
218 | $context['loop']['first'] = false; |
||
219 | if (isset($context['loop']['length'])) { |
||
220 | --$context['loop']['revindex0']; |
||
221 | --$context['loop']['revindex']; |
||
222 | $context['loop']['last'] = 0 === $context['loop']['revindex0']; |
||
223 | } |
||
224 | } |
||
225 | $_parent = $context['_parent']; |
||
226 | unset($context['_seq'], $context['_iterated'], $context['_key'], $context['entry'], $context['_parent'], $context['loop']); |
||
227 | $context = array_intersect_key($context, $_parent) + $_parent; |
||
228 | // line 40 |
||
229 | echo " </div> |
||
230 | "; |
||
231 | |||
232 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof); |
||
233 | |||
234 | } |
||
235 | |||
236 | // line 43 |
||
237 | public function block_system($context, array $blocks = []) |
||
238 | { |
||
239 | $macros = $this->macros; |
||
240 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"]; |
||
241 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "system")); |
||
242 | |||
243 | // line 44 |
||
244 | echo " <div class=\"system\"> |
||
245 | "; |
||
246 | // line 45 |
||
247 | $this->displayBlock("section", $context, $blocks); |
||
248 | echo " |
||
249 | </div> |
||
250 | "; |
||
251 | |||
252 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof); |
||
253 | |||
254 | } |
||
255 | |||
256 | // line 49 |
||
257 | public function block_icon($context, array $blocks = []) |
||
258 | { |
||
259 | $macros = $this->macros; |
||
260 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"]; |
||
261 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "icon")); |
||
262 | |||
263 | // line 50 |
||
264 | echo " "; |
||
265 | if ((isset($context["icon"]) || array_key_exists("icon", $context) ? $context["icon"] : (function () { throw new RuntimeError('Variable "icon" does not exist.', 50, $this->source); })())) { |
||
266 | // line 51 |
||
267 | echo " "; |
||
268 | echo twig_source($this->env, (isset($context["icon"]) || array_key_exists("icon", $context) ? $context["icon"] : (function () { throw new RuntimeError('Variable "icon" does not exist.', 51, $this->source); })())); |
||
269 | echo " |
||
270 | "; |
||
271 | } else { |
||
272 | // line 53 |
||
273 | echo " "; |
||
274 | echo twig_source($this->env, "@Menu/svg/default_folder.svg"); |
||
275 | echo " |
||
276 | "; |
||
277 | } |
||
278 | |||
279 | $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof); |
||
280 | |||
281 | } |
||
282 | |||
283 | public function getTemplateName() |
||
284 | { |
||
285 | return "@Menu/menu_blocks.html.twig"; |
||
286 | } |
||
287 | |||
288 | public function getDebugInfo() |
||
289 | { |
||
290 | return array ( 273 => 53, 267 => 51, 264 => 50, 257 => 49, 247 => 45, 244 => 44, 237 => 43, 229 => 40, 212 => 38, 195 => 37, 188 => 34, 181 => 33, 170 => 29, 168 => 28, 165 => 27, 159 => 25, 157 => 24, 154 => 23, 148 => 21, 145 => 20, 138 => 19, 128 => 15, 124 => 14, 121 => 13, 115 => 12, 111 => 11, 108 => 10, 105 => 9, 103 => 8, 100 => 7, 97 => 6, 94 => 5, 91 => 4, 88 => 3, 85 => 2, 78 => 1, 67 => 56, 65 => 49, 62 => 48, 60 => 43, 57 => 42, 55 => 33, 52 => 32, 50 => 19, 47 => 18, 45 => 1,); |
||
291 | } |
||
292 | |||
293 | public function getSourceContext() |
||
355 | } |
||
356 | } |
||
357 |