Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like __TwigTemplate_1af9ac9d8e6bdab055b91c0b315695ba76def72622bbd698fddd8fae39f228e2 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. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
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_1af9ac9d8e6bdab055b91c0b315695ba76def72622bbd698fddd8fae39f228e2, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
4 | class __TwigTemplate_1af9ac9d8e6bdab055b91c0b315695ba76def72622bbd698fddd8fae39f228e2 extends Twig_Template |
||
5 | { |
||
6 | public function __construct(Twig_Environment $env) |
||
7 | { |
||
8 | parent::__construct($env); |
||
9 | |||
10 | $this->parent = false; |
||
11 | |||
12 | $this->blocks = array( |
||
13 | 'search_index' => array($this, 'block_search_index'), |
||
14 | 'search_index_extra' => array($this, 'block_search_index_extra'), |
||
15 | 'treejs' => array($this, 'block_treejs'), |
||
16 | ); |
||
17 | } |
||
18 | |||
19 | protected function doDisplay(array $context, array $blocks = array()) |
||
20 | { |
||
21 | // line 1 |
||
22 | $context["__internal_3abfe7d95b8e3dc37a5cb5534978c7915201cd06e8e3449801da4b7670b2eea7"] = $this; |
||
23 | // line 2 |
||
24 | echo " |
||
25 | (function(root) { |
||
26 | |||
27 | var bhIndex = null; |
||
28 | var rootPath = ''; |
||
29 | var treeHtml = '"; |
||
30 | // line 7 |
||
31 | echo twig_replace_filter($context["__internal_3abfe7d95b8e3dc37a5cb5534978c7915201cd06e8e3449801da4b7670b2eea7"]->getelement((isset($context["tree"]) ? $context["tree"] : $this->getContext($context, "tree")), $this->getAttribute((isset($context["project"]) ? $context["project"] : $this->getContext($context, "project")), "config", array(0 => "default_opened_level"), "method"), 0), array("'" => "\\'", " |
||
32 | " => "")); |
||
33 | echo "'; |
||
34 | |||
35 | var searchTypeClasses = { |
||
36 | 'Namespace': 'label-default', |
||
37 | 'Class': 'label-info', |
||
38 | 'Interface': 'label-primary', |
||
39 | 'Trait': 'label-success', |
||
40 | 'Method': 'label-danger', |
||
41 | '_': 'label-warning' |
||
42 | }; |
||
43 | |||
44 | var searchIndex = [ |
||
45 | "; |
||
46 | // line 19 |
||
47 | $this->displayBlock('search_index', $context, $blocks); |
||
48 | // line 39 |
||
49 | echo " // Fix trailing commas in the index |
||
50 | {} |
||
51 | ]; |
||
52 | |||
53 | /** Tokenizes strings by namespaces and functions */ |
||
54 | function tokenizer(term) { |
||
55 | if (!term) { |
||
56 | return []; |
||
57 | } |
||
58 | |||
59 | var tokens = [term]; |
||
60 | var meth = term.indexOf('::'); |
||
61 | |||
62 | // Split tokens into methods if \"::\" is found. |
||
63 | if (meth > -1) { |
||
64 | tokens.push(term.substr(meth + 2)); |
||
65 | term = term.substr(0, meth - 2); |
||
66 | } |
||
67 | |||
68 | // Split by namespace or fake namespace. |
||
69 | if (term.indexOf('\\\\') > -1) { |
||
70 | tokens = tokens.concat(term.split('\\\\')); |
||
71 | } else if (term.indexOf('_') > 0) { |
||
72 | tokens = tokens.concat(term.split('_')); |
||
73 | } |
||
74 | |||
75 | // Merge in splitting the string by case and return |
||
76 | tokens = tokens.concat(term.match(/(([A-Z]?[^A-Z]*)|([a-z]?[^a-z]*))/g).slice(0,-1)); |
||
77 | |||
78 | return tokens; |
||
79 | }; |
||
80 | |||
81 | root.Sami = { |
||
82 | /** |
||
83 | * Cleans the provided term. If no term is provided, then one is |
||
84 | * grabbed from the query string \"search\" parameter. |
||
85 | */ |
||
86 | cleanSearchTerm: function(term) { |
||
87 | // Grab from the query string |
||
88 | if (typeof term === 'undefined') { |
||
89 | var name = 'search'; |
||
90 | var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\"); |
||
91 | var results = regex.exec(location.search); |
||
92 | if (results === null) { |
||
93 | return null; |
||
94 | } |
||
95 | term = decodeURIComponent(results[1].replace(/\\+/g, \" \")); |
||
96 | } |
||
97 | |||
98 | return term.replace(/<(?:.|\\n)*?>/gm, ''); |
||
99 | }, |
||
100 | |||
101 | /** Searches through the index for a given term */ |
||
102 | search: function(term) { |
||
103 | // Create a new search index if needed |
||
104 | if (!bhIndex) { |
||
105 | bhIndex = new Bloodhound({ |
||
106 | limit: 500, |
||
107 | local: searchIndex, |
||
108 | datumTokenizer: function (d) { |
||
109 | return tokenizer(d.name); |
||
110 | }, |
||
111 | queryTokenizer: Bloodhound.tokenizers.whitespace |
||
112 | }); |
||
113 | bhIndex.initialize(); |
||
114 | } |
||
115 | |||
116 | results = []; |
||
117 | bhIndex.get(term, function(matches) { |
||
118 | results = matches; |
||
119 | }); |
||
120 | |||
121 | if (!rootPath) { |
||
122 | return results; |
||
123 | } |
||
124 | |||
125 | // Fix the element links based on the current page depth. |
||
126 | return \$.map(results, function(ele) { |
||
127 | if (ele.link.indexOf('..') > -1) { |
||
128 | return ele; |
||
129 | } |
||
130 | ele.link = rootPath + ele.link; |
||
131 | if (ele.fromLink) { |
||
132 | ele.fromLink = rootPath + ele.fromLink; |
||
133 | } |
||
134 | return ele; |
||
135 | }); |
||
136 | }, |
||
137 | |||
138 | /** Get a search class for a specific type */ |
||
139 | getSearchClass: function(type) { |
||
140 | return searchTypeClasses[type] || searchTypeClasses['_']; |
||
141 | }, |
||
142 | |||
143 | /** Add the left-nav tree to the site */ |
||
144 | injectApiTree: function(ele) { |
||
145 | ele.html(treeHtml); |
||
146 | } |
||
147 | }; |
||
148 | |||
149 | \$(function() { |
||
150 | // Modify the HTML to work correctly based on the current depth |
||
151 | rootPath = \$('body').attr('data-root-path'); |
||
152 | treeHtml = treeHtml.replace(/href=\"/g, 'href=\"' + rootPath); |
||
153 | Sami.injectApiTree(\$('#api-tree')); |
||
154 | }); |
||
155 | |||
156 | return root.Sami; |
||
157 | })(window); |
||
158 | |||
159 | \$(function() { |
||
160 | |||
161 | // Enable the version switcher |
||
162 | \$('#version-switcher').change(function() { |
||
163 | window.location = \$(this).val() |
||
164 | }); |
||
165 | |||
166 | "; |
||
167 | // line 156 |
||
168 | $this->displayBlock('treejs', $context, $blocks); |
||
169 | // line 182 |
||
170 | echo " |
||
171 | "; |
||
172 | // line 210 |
||
173 | echo " |
||
174 | var form = \$('#search-form .typeahead'); |
||
175 | form.typeahead({ |
||
176 | hint: true, |
||
177 | highlight: true, |
||
178 | minLength: 1 |
||
179 | }, { |
||
180 | name: 'search', |
||
181 | displayKey: 'name', |
||
182 | source: function (q, cb) { |
||
183 | cb(Sami.search(q)); |
||
184 | } |
||
185 | }); |
||
186 | |||
187 | // The selection is direct-linked when the user selects a suggestion. |
||
188 | form.on('typeahead:selected', function(e, suggestion) { |
||
189 | window.location = suggestion.link; |
||
190 | }); |
||
191 | |||
192 | // The form is submitted when the user hits enter. |
||
193 | form.keypress(function (e) { |
||
194 | if (e.which == 13) { |
||
195 | \$('#search-form').submit(); |
||
196 | return true; |
||
197 | } |
||
198 | }); |
||
199 | |||
200 | "; |
||
201 | echo " |
||
202 | }); |
||
203 | |||
204 | "; |
||
205 | // line 222 |
||
206 | echo " |
||
207 | "; |
||
208 | } |
||
209 | |||
210 | // line 19 |
||
211 | public function block_search_index($context, array $blocks = array()) |
||
212 | { |
||
213 | // line 20 |
||
214 | echo " "; |
||
215 | $context["__internal_fec9f14ad72298db06597a5026d98ea3d54ffe884d2fe9be935abccf0d16efba"] = $this; |
||
216 | // line 21 |
||
217 | echo " |
||
218 | "; |
||
219 | // line 22 |
||
220 | $context['_parent'] = $context; |
||
221 | $context['_seq'] = twig_ensure_traversable((isset($context["namespaces"]) ? $context["namespaces"] : $this->getContext($context, "namespaces"))); |
||
222 | foreach ($context['_seq'] as $context["_key"] => $context["ns"]) { |
||
223 | // line 23 |
||
224 | echo "{\"type\": \"Namespace\", \"link\": \""; |
||
225 | echo $this->env->getExtension('sami')->pathForNamespace($context, $context["ns"]); |
||
226 | echo "\", \"name\": \""; |
||
227 | echo twig_replace_filter($context["ns"], array("\\" => "\\\\")); |
||
228 | echo "\", \"doc\": \"Namespace "; |
||
229 | echo twig_replace_filter($context["ns"], array("\\" => "\\\\")); |
||
230 | echo "\"},"; |
||
231 | } |
||
232 | $_parent = $context['_parent']; |
||
233 | unset($context['_seq'], $context['_iterated'], $context['_key'], $context['ns'], $context['_parent'], $context['loop']); |
||
234 | $context = array_intersect_key($context, $_parent) + $_parent; |
||
235 | // line 25 |
||
236 | echo " |
||
237 | "; |
||
238 | // line 26 |
||
239 | $context['_parent'] = $context; |
||
240 | $context['_seq'] = twig_ensure_traversable((isset($context["interfaces"]) ? $context["interfaces"] : $this->getContext($context, "interfaces"))); |
||
241 | foreach ($context['_seq'] as $context["_key"] => $context["class"]) { |
||
242 | // line 27 |
||
243 | echo "{\"type\": \"Interface\", "; |
||
244 | if ($this->getAttribute($context["class"], "namespace", array())) { |
||
245 | echo "\"fromName\": \""; |
||
246 | echo twig_replace_filter($this->getAttribute($context["class"], "namespace", array()), array("\\" => "\\\\")); |
||
247 | echo "\", \"fromLink\": \""; |
||
248 | echo $this->env->getExtension('sami')->pathForNamespace($context, $this->getAttribute($context["class"], "namespace", array())); |
||
249 | echo "\","; |
||
250 | } |
||
251 | echo " \"link\": \""; |
||
252 | echo $this->env->getExtension('sami')->pathForClass($context, $context["class"]); |
||
253 | echo "\", \"name\": \""; |
||
254 | echo twig_replace_filter($this->getAttribute($context["class"], "name", array()), array("\\" => "\\\\")); |
||
255 | echo "\", \"doc\": \""; |
||
256 | echo twig_escape_filter($this->env, twig_jsonencode_filter($this->env->getExtension('sami')->parseDesc($context, $this->getAttribute($context["class"], "shortdesc", array()), $context["class"])), "html", null, true); |
||
257 | echo "\"}, |
||
258 | "; |
||
259 | // line 28 |
||
260 | echo $context["__internal_fec9f14ad72298db06597a5026d98ea3d54ffe884d2fe9be935abccf0d16efba"]->getadd_class_methods_index($context["class"]); |
||
261 | echo " |
||
262 | "; |
||
263 | } |
||
264 | $_parent = $context['_parent']; |
||
265 | unset($context['_seq'], $context['_iterated'], $context['_key'], $context['class'], $context['_parent'], $context['loop']); |
||
266 | $context = array_intersect_key($context, $_parent) + $_parent; |
||
267 | // line 30 |
||
268 | echo " |
||
269 | "; |
||
270 | // line 31 |
||
271 | $context['_parent'] = $context; |
||
272 | $context['_seq'] = twig_ensure_traversable((isset($context["classes"]) ? $context["classes"] : $this->getContext($context, "classes"))); |
||
273 | foreach ($context['_seq'] as $context["_key"] => $context["class"]) { |
||
274 | // line 32 |
||
275 | echo "{\"type\": "; |
||
276 | if ($this->getAttribute($context["class"], "isTrait", array())) { |
||
277 | echo "\"Trait\""; |
||
278 | } else { |
||
279 | echo "\"Class\""; |
||
280 | } |
||
281 | echo ", "; |
||
282 | if ($this->getAttribute($context["class"], "namespace", array())) { |
||
283 | echo "\"fromName\": \""; |
||
284 | echo twig_replace_filter($this->getAttribute($context["class"], "namespace", array()), array("\\" => "\\\\")); |
||
285 | echo "\", \"fromLink\": \""; |
||
286 | echo $this->env->getExtension('sami')->pathForNamespace($context, $this->getAttribute($context["class"], "namespace", array())); |
||
287 | echo "\","; |
||
288 | } |
||
289 | echo " \"link\": \""; |
||
290 | echo $this->env->getExtension('sami')->pathForClass($context, $context["class"]); |
||
291 | echo "\", \"name\": \""; |
||
292 | echo twig_replace_filter($this->getAttribute($context["class"], "name", array()), array("\\" => "\\\\")); |
||
293 | echo "\", \"doc\": \""; |
||
294 | echo twig_escape_filter($this->env, twig_jsonencode_filter($this->env->getExtension('sami')->parseDesc($context, $this->getAttribute($context["class"], "shortdesc", array()), $context["class"])), "html", null, true); |
||
295 | echo "\"}, |
||
296 | "; |
||
297 | // line 33 |
||
298 | echo $context["__internal_fec9f14ad72298db06597a5026d98ea3d54ffe884d2fe9be935abccf0d16efba"]->getadd_class_methods_index($context["class"]); |
||
299 | echo " |
||
300 | "; |
||
301 | } |
||
302 | $_parent = $context['_parent']; |
||
303 | unset($context['_seq'], $context['_iterated'], $context['_key'], $context['class'], $context['_parent'], $context['loop']); |
||
304 | $context = array_intersect_key($context, $_parent) + $_parent; |
||
305 | // line 35 |
||
306 | echo " |
||
307 | "; |
||
308 | // line 37 |
||
309 | echo " "; |
||
310 | $this->displayBlock('search_index_extra', $context, $blocks); |
||
311 | // line 38 |
||
312 | echo " "; |
||
313 | } |
||
314 | |||
315 | // line 37 |
||
316 | public function block_search_index_extra($context, array $blocks = array()) |
||
317 | { |
||
318 | echo ""; |
||
319 | } |
||
320 | |||
321 | // line 156 |
||
322 | public function block_treejs($context, array $blocks = array()) |
||
323 | { |
||
324 | // line 157 |
||
325 | echo " |
||
326 | // Toggle left-nav divs on click |
||
327 | \$('#api-tree .hd span').click(function() { |
||
328 | \$(this).parent().parent().toggleClass('opened'); |
||
329 | }); |
||
330 | |||
331 | // Expand the parent namespaces of the current page. |
||
332 | var expected = \$('body').attr('data-name'); |
||
333 | |||
334 | if (expected) { |
||
335 | // Open the currently selected node and its parents. |
||
336 | var container = \$('#api-tree'); |
||
337 | var node = \$('#api-tree li[data-name=\"' + expected + '\"]'); |
||
338 | // Node might not be found when simulating namespaces |
||
339 | if (node.length > 0) { |
||
340 | node.addClass('active').addClass('opened'); |
||
341 | node.parents('li').addClass('opened'); |
||
342 | var scrollPos = node.offset().top - container.offset().top + container.scrollTop(); |
||
343 | // Position the item nearer to the top of the screen. |
||
344 | scrollPos -= 200; |
||
345 | container.scrollTop(scrollPos); |
||
346 | } |
||
347 | } |
||
348 | |||
349 | "; |
||
350 | } |
||
351 | |||
352 | // line 213 |
||
353 | public function getadd_class_methods_index($__class__ = null, ...$__varargs__) |
||
354 | { |
||
355 | $context = $this->env->mergeGlobals(array( |
||
356 | "class" => $__class__, |
||
357 | "varargs" => $__varargs__, |
||
358 | )); |
||
359 | |||
360 | $blocks = array(); |
||
361 | |||
362 | ob_start(); |
||
363 | try { |
||
364 | // line 214 |
||
365 | echo " "; |
||
366 | if ($this->getAttribute((isset($context["class"]) ? $context["class"] : $this->getContext($context, "class")), "methods", array())) { |
||
367 | // line 215 |
||
368 | echo " "; |
||
369 | $context["from_name"] = twig_replace_filter($this->getAttribute((isset($context["class"]) ? $context["class"] : $this->getContext($context, "class")), "name", array()), array("\\" => "\\\\")); |
||
370 | // line 216 |
||
371 | echo " "; |
||
372 | $context["from_link"] = $this->env->getExtension('sami')->pathForClass($context, (isset($context["class"]) ? $context["class"] : $this->getContext($context, "class"))); |
||
373 | // line 217 |
||
374 | echo " "; |
||
375 | $context['_parent'] = $context; |
||
376 | $context['_seq'] = twig_ensure_traversable($this->getAttribute((isset($context["class"]) ? $context["class"] : $this->getContext($context, "class")), "methods", array())); |
||
377 | foreach ($context['_seq'] as $context["_key"] => $context["meth"]) { |
||
378 | // line 218 |
||
379 | echo " {\"type\": \"Method\", \"fromName\": \""; |
||
380 | echo (isset($context["from_name"]) ? $context["from_name"] : $this->getContext($context, "from_name")); |
||
381 | echo "\", \"fromLink\": \""; |
||
382 | echo (isset($context["from_link"]) ? $context["from_link"] : $this->getContext($context, "from_link")); |
||
383 | echo "\", \"link\": \""; |
||
384 | echo $this->env->getExtension('sami')->pathForMethod($context, $context["meth"]); |
||
385 | echo "\", \"name\": \""; |
||
386 | echo twig_replace_filter($context["meth"], array("\\" => "\\\\")); |
||
387 | echo "\", \"doc\": \""; |
||
388 | echo twig_escape_filter($this->env, twig_jsonencode_filter($this->env->getExtension('sami')->parseDesc($context, $this->getAttribute($context["meth"], "shortdesc", array()), (isset($context["class"]) ? $context["class"] : $this->getContext($context, "class")))), "html", null, true); |
||
389 | echo "\"}, |
||
390 | "; |
||
391 | } |
||
392 | $_parent = $context['_parent']; |
||
393 | unset($context['_seq'], $context['_iterated'], $context['_key'], $context['meth'], $context['_parent'], $context['loop']); |
||
394 | $context = array_intersect_key($context, $_parent) + $_parent; |
||
395 | // line 220 |
||
396 | echo " "; |
||
397 | } |
||
398 | } catch (Exception $e) { |
||
399 | ob_end_clean(); |
||
400 | |||
401 | throw $e; |
||
402 | } catch (Throwable $e) { |
||
403 | ob_end_clean(); |
||
404 | |||
405 | throw $e; |
||
406 | } |
||
407 | |||
408 | return ('' === $tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); |
||
409 | } |
||
410 | |||
411 | // line 223 |
||
412 | public function getelement($__tree__ = null, $__opened__ = null, $__depth__ = null, ...$__varargs__) |
||
413 | { |
||
414 | $context = $this->env->mergeGlobals(array( |
||
415 | "tree" => $__tree__, |
||
416 | "opened" => $__opened__, |
||
417 | "depth" => $__depth__, |
||
418 | "varargs" => $__varargs__, |
||
419 | )); |
||
420 | |||
421 | $blocks = array(); |
||
422 | |||
423 | ob_start(); |
||
424 | try { |
||
425 | // line 224 |
||
426 | echo " "; |
||
427 | $context["__internal_203852106d81b21fad240b3e53ecbd07d6dc0c94215c15f2799adb4e5d97d8fa"] = $this; |
||
428 | // line 225 |
||
429 | echo " |
||
430 | <ul>"; |
||
431 | // line 227 |
||
432 | $context['_parent'] = $context; |
||
433 | $context['_seq'] = twig_ensure_traversable((isset($context["tree"]) ? $context["tree"] : $this->getContext($context, "tree"))); |
||
434 | foreach ($context['_seq'] as $context["_key"] => $context["element"]) { |
||
435 | // line 228 |
||
436 | if ($this->getAttribute($context["element"], 2, array(), "array")) { |
||
437 | // line 229 |
||
438 | echo " <li data-name=\"namespace:"; |
||
439 | echo twig_replace_filter($this->getAttribute($context["element"], 1, array(), "array"), array("\\" => "_")); |
||
440 | echo "\" "; |
||
441 | if (((isset($context["depth"]) ? $context["depth"] : $this->getContext($context, "depth")) < (isset($context["opened"]) ? $context["opened"] : $this->getContext($context, "opened")))) { |
||
442 | echo "class=\"opened\""; |
||
443 | } |
||
444 | echo "> |
||
445 | <div style=\"padding-left:"; |
||
446 | // line 230 |
||
447 | echo ((isset($context["depth"]) ? $context["depth"] : $this->getContext($context, "depth")) * 18); |
||
448 | echo "px\" class=\"hd\"> |
||
449 | <span class=\"glyphicon glyphicon-play\"></span>"; |
||
450 | // line 231 |
||
451 | if ( !$this->getAttribute((isset($context["project"]) ? $context["project"] : $this->getContext($context, "project")), "config", array(0 => "simulate_namespaces"), "method")) { |
||
452 | echo "<a href=\""; |
||
453 | echo $this->env->getExtension('sami')->pathForNamespace($context, $this->getAttribute($context["element"], 1, array(), "array")); |
||
454 | echo "\">"; |
||
455 | } |
||
456 | echo $this->getAttribute($context["element"], 0, array(), "array"); |
||
457 | if ( !$this->getAttribute((isset($context["project"]) ? $context["project"] : $this->getContext($context, "project")), "config", array(0 => "simulate_namespaces"), "method")) { |
||
458 | echo "</a>"; |
||
459 | } |
||
460 | // line 232 |
||
461 | echo " </div> |
||
462 | <div class=\"bd\"> |
||
463 | "; |
||
464 | // line 234 |
||
465 | echo $context["__internal_203852106d81b21fad240b3e53ecbd07d6dc0c94215c15f2799adb4e5d97d8fa"]->getelement($this->getAttribute($context["element"], 2, array(), "array"), (isset($context["opened"]) ? $context["opened"] : $this->getContext($context, "opened")), ((isset($context["depth"]) ? $context["depth"] : $this->getContext($context, "depth")) + 1)); |
||
466 | // line 235 |
||
467 | echo "</div> |
||
468 | </li> |
||
469 | "; |
||
470 | } else { |
||
471 | // line 238 |
||
472 | echo " <li data-name=\"class:"; |
||
473 | echo twig_escape_filter($this->env, twig_replace_filter($this->getAttribute($this->getAttribute($context["element"], 1, array(), "array"), "name", array()), array("\\" => "_")), "html", null, true); |
||
474 | echo "\" "; |
||
475 | if (((isset($context["depth"]) ? $context["depth"] : $this->getContext($context, "depth")) < (isset($context["opened"]) ? $context["opened"] : $this->getContext($context, "opened")))) { |
||
476 | echo "class=\"opened\""; |
||
477 | } |
||
478 | echo "> |
||
479 | <div style=\"padding-left:"; |
||
480 | // line 239 |
||
481 | echo twig_escape_filter($this->env, (8 + ((isset($context["depth"]) ? $context["depth"] : $this->getContext($context, "depth")) * 18)), "html", null, true); |
||
482 | echo "px\" class=\"hd leaf\"> |
||
483 | <a href=\""; |
||
484 | // line 240 |
||
485 | echo $this->env->getExtension('sami')->pathForClass($context, $this->getAttribute($context["element"], 1, array(), "array")); |
||
486 | echo "\">"; |
||
487 | echo twig_escape_filter($this->env, $this->getAttribute($context["element"], 0, array(), "array"), "html", null, true); |
||
488 | echo "</a> |
||
489 | </div> |
||
490 | </li> |
||
491 | "; |
||
492 | } |
||
493 | } |
||
494 | $_parent = $context['_parent']; |
||
495 | unset($context['_seq'], $context['_iterated'], $context['_key'], $context['element'], $context['_parent'], $context['loop']); |
||
496 | $context = array_intersect_key($context, $_parent) + $_parent; |
||
497 | // line 245 |
||
498 | echo " </ul> |
||
499 | "; |
||
500 | } catch (Exception $e) { |
||
501 | ob_end_clean(); |
||
502 | |||
503 | throw $e; |
||
504 | } catch (Throwable $e) { |
||
505 | ob_end_clean(); |
||
506 | |||
507 | throw $e; |
||
508 | } |
||
509 | |||
510 | return ('' === $tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); |
||
511 | } |
||
512 | |||
513 | public function getTemplateName() |
||
514 | { |
||
515 | return "sami.js.twig"; |
||
516 | } |
||
517 | |||
518 | public function isTraitable() |
||
519 | { |
||
520 | return false; |
||
521 | } |
||
522 | |||
523 | public function getDebugInfo() |
||
524 | { |
||
525 | return array ( 498 => 245, 485 => 240, 481 => 239, 472 => 238, 467 => 235, 465 => 234, 461 => 232, 451 => 231, 447 => 230, 438 => 229, 436 => 228, 432 => 227, 429 => 225, 426 => 224, 412 => 223, 396 => 220, 379 => 218, 374 => 217, 371 => 216, 368 => 215, 365 => 214, 353 => 213, 325 => 157, 322 => 156, 316 => 37, 312 => 38, 309 => 37, 306 => 35, 298 => 33, 275 => 32, 271 => 31, 268 => 30, 260 => 28, 243 => 27, 239 => 26, 236 => 25, 224 => 23, 220 => 22, 217 => 21, 214 => 20, 211 => 19, 206 => 222, 173 => 210, 170 => 182, 168 => 156, 49 => 39, 47 => 19, 31 => 7, 24 => 2, 22 => 1,); |
||
526 | } |
||
527 | } |
||
528 | /* {% from _self import element %}*/ |
||
775 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.