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_0c98c7d9efdade68f1155a74052b73d36eef0cc95665e5dce2e9d330ca46289c 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_0c98c7d9efdade68f1155a74052b73d36eef0cc95665e5dce2e9d330ca46289c, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 4 | class __TwigTemplate_0c98c7d9efdade68f1155a74052b73d36eef0cc95665e5dce2e9d330ca46289c 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 | ); |
||
| 14 | } |
||
| 15 | |||
| 16 | protected function doDisplay(array $context, array $blocks = array()) |
||
| 17 | { |
||
| 18 | // line 4 |
||
| 19 | echo " |
||
| 20 | "; |
||
| 21 | // line 14 |
||
| 22 | echo " |
||
| 23 | "; |
||
| 24 | // line 20 |
||
| 25 | echo " |
||
| 26 | "; |
||
| 27 | // line 26 |
||
| 28 | echo " |
||
| 29 | "; |
||
| 30 | // line 42 |
||
| 31 | echo " |
||
| 32 | "; |
||
| 33 | // line 48 |
||
| 34 | echo " |
||
| 35 | "; |
||
| 36 | // line 56 |
||
| 37 | echo " |
||
| 38 | "; |
||
| 39 | // line 60 |
||
| 40 | echo " |
||
| 41 | "; |
||
| 42 | // line 72 |
||
| 43 | echo " |
||
| 44 | "; |
||
| 45 | // line 94 |
||
| 46 | echo " |
||
| 47 | "; |
||
| 48 | // line 106 |
||
| 49 | echo " |
||
| 50 | "; |
||
| 51 | // line 110 |
||
| 52 | echo " |
||
| 53 | "; |
||
| 54 | } |
||
| 55 | |||
| 56 | // line 1 |
||
| 57 | public function macro_namespace_link($__namespace__ = null, ...$__varargs__) |
||
| 58 | { |
||
| 59 | $context = $this->env->mergeGlobals(array( |
||
| 60 | "namespace" => $__namespace__, |
||
| 61 | "varargs" => $__varargs__, |
||
| 62 | )); |
||
| 63 | |||
| 64 | $blocks = array(); |
||
| 65 | |||
| 66 | ob_start(); |
||
| 67 | try { |
||
| 68 | // line 2 |
||
| 69 | echo "<a href=\""; |
||
| 70 | echo $this->env->getExtension('Sami\Renderer\TwigExtension')->pathForNamespace($context, (isset($context["namespace"]) || array_key_exists("namespace", $context) ? $context["namespace"] : (function () { throw new Twig_Error_Runtime('Variable "namespace" does not exist.', 2, $this->getSourceContext()); })())); |
||
| 71 | echo "\">"; |
||
| 72 | echo (isset($context["namespace"]) || array_key_exists("namespace", $context) ? $context["namespace"] : (function () { throw new Twig_Error_Runtime('Variable "namespace" does not exist.', 2, $this->getSourceContext()); })()); |
||
| 73 | echo "</a>"; |
||
| 74 | |||
| 75 | return ('' === $tmp = ob_get_contents()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); |
||
| 76 | } finally { |
||
| 77 | ob_end_clean(); |
||
| 78 | } |
||
| 79 | } |
||
| 80 | |||
| 81 | // line 5 |
||
| 82 | public function macro_class_link($__class__ = null, $__absolute__ = null, ...$__varargs__) |
||
| 83 | { |
||
| 84 | $context = $this->env->mergeGlobals(array( |
||
| 85 | "class" => $__class__, |
||
| 86 | "absolute" => $__absolute__, |
||
| 87 | "varargs" => $__varargs__, |
||
| 88 | )); |
||
| 89 | |||
| 90 | $blocks = array(); |
||
| 91 | |||
| 92 | ob_start(); |
||
| 93 | try { |
||
| 94 | // line 6 |
||
| 95 | if (twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["class"]) || array_key_exists("class", $context) ? $context["class"] : (function () { throw new Twig_Error_Runtime('Variable "class" does not exist.', 6, $this->getSourceContext()); })()), "projectclass", array())) { |
||
| 96 | // line 7 |
||
| 97 | echo "<a href=\""; |
||
| 98 | echo $this->env->getExtension('Sami\Renderer\TwigExtension')->pathForClass($context, (isset($context["class"]) || array_key_exists("class", $context) ? $context["class"] : (function () { throw new Twig_Error_Runtime('Variable "class" does not exist.', 7, $this->getSourceContext()); })())); |
||
| 99 | echo "\">"; |
||
| 100 | } elseif (twig_get_attribute($this->env, $this->getSourceContext(), // line 8 |
||
| 101 | (isset($context["class"]) || array_key_exists("class", $context) ? $context["class"] : (function () { throw new Twig_Error_Runtime('Variable "class" does not exist.', 8, $this->getSourceContext()); })()), "phpclass", array())) { |
||
| 102 | // line 9 |
||
| 103 | echo "<a target=\"_blank\" href=\"http://php.net/"; |
||
| 104 | echo (isset($context["class"]) || array_key_exists("class", $context) ? $context["class"] : (function () { throw new Twig_Error_Runtime('Variable "class" does not exist.', 9, $this->getSourceContext()); })()); |
||
| 105 | echo "\">"; |
||
| 106 | } |
||
| 107 | // line 11 |
||
| 108 | echo $this->env->getExtension('Sami\Renderer\TwigExtension')->abbrClass((isset($context["class"]) || array_key_exists("class", $context) ? $context["class"] : (function () { throw new Twig_Error_Runtime('Variable "class" does not exist.', 11, $this->getSourceContext()); })()), ((array_key_exists("absolute", $context)) ? (_twig_default_filter((isset($context["absolute"]) || array_key_exists("absolute", $context) ? $context["absolute"] : (function () { throw new Twig_Error_Runtime('Variable "absolute" does not exist.', 11, $this->getSourceContext()); })()), false)) : (false))); |
||
| 109 | // line 12 |
||
| 110 | if ((twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["class"]) || array_key_exists("class", $context) ? $context["class"] : (function () { throw new Twig_Error_Runtime('Variable "class" does not exist.', 12, $this->getSourceContext()); })()), "projectclass", array()) || twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["class"]) || array_key_exists("class", $context) ? $context["class"] : (function () { throw new Twig_Error_Runtime('Variable "class" does not exist.', 12, $this->getSourceContext()); })()), "phpclass", array()))) { |
||
| 111 | echo "</a>"; |
||
| 112 | } |
||
| 113 | |||
| 114 | return ('' === $tmp = ob_get_contents()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); |
||
| 115 | } finally { |
||
| 116 | ob_end_clean(); |
||
| 117 | } |
||
| 118 | } |
||
| 119 | |||
| 120 | // line 15 |
||
| 121 | public function macro_method_link($__method__ = null, $__absolute__ = null, $__classonly__ = null, ...$__varargs__) |
||
| 122 | { |
||
| 123 | $context = $this->env->mergeGlobals(array( |
||
| 124 | "method" => $__method__, |
||
| 125 | "absolute" => $__absolute__, |
||
| 126 | "classonly" => $__classonly__, |
||
| 127 | "varargs" => $__varargs__, |
||
| 128 | )); |
||
| 129 | |||
| 130 | $blocks = array(); |
||
| 131 | |||
| 132 | ob_start(); |
||
| 133 | try { |
||
| 134 | // line 16 |
||
| 135 | echo "<a href=\""; |
||
| 136 | echo $this->env->getExtension('Sami\Renderer\TwigExtension')->pathForMethod($context, (isset($context["method"]) || array_key_exists("method", $context) ? $context["method"] : (function () { throw new Twig_Error_Runtime('Variable "method" does not exist.', 16, $this->getSourceContext()); })())); |
||
| 137 | echo "\">"; |
||
| 138 | // line 17 |
||
| 139 | echo $this->env->getExtension('Sami\Renderer\TwigExtension')->abbrClass(twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["method"]) || array_key_exists("method", $context) ? $context["method"] : (function () { throw new Twig_Error_Runtime('Variable "method" does not exist.', 17, $this->getSourceContext()); })()), "class", array())); |
||
| 140 | if ( !((array_key_exists("classonly", $context)) ? (_twig_default_filter((isset($context["classonly"]) || array_key_exists("classonly", $context) ? $context["classonly"] : (function () { throw new Twig_Error_Runtime('Variable "classonly" does not exist.', 17, $this->getSourceContext()); })()), false)) : (false))) { |
||
| 141 | echo "::"; |
||
| 142 | echo twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["method"]) || array_key_exists("method", $context) ? $context["method"] : (function () { throw new Twig_Error_Runtime('Variable "method" does not exist.', 17, $this->getSourceContext()); })()), "name", array()); |
||
| 143 | } |
||
| 144 | // line 18 |
||
| 145 | echo "</a>"; |
||
| 146 | |||
| 147 | return ('' === $tmp = ob_get_contents()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); |
||
| 148 | } finally { |
||
| 149 | ob_end_clean(); |
||
| 150 | } |
||
| 151 | } |
||
| 152 | |||
| 153 | // line 21 |
||
| 154 | public function macro_property_link($__property__ = null, $__absolute__ = null, $__classonly__ = null, ...$__varargs__) |
||
| 155 | { |
||
| 156 | $context = $this->env->mergeGlobals(array( |
||
| 157 | "property" => $__property__, |
||
| 158 | "absolute" => $__absolute__, |
||
| 159 | "classonly" => $__classonly__, |
||
| 160 | "varargs" => $__varargs__, |
||
| 161 | )); |
||
| 162 | |||
| 163 | $blocks = array(); |
||
| 164 | |||
| 165 | ob_start(); |
||
| 166 | try { |
||
| 167 | // line 22 |
||
| 168 | echo "<a href=\""; |
||
| 169 | echo $this->env->getExtension('Sami\Renderer\TwigExtension')->pathForProperty($context, (isset($context["property"]) || array_key_exists("property", $context) ? $context["property"] : (function () { throw new Twig_Error_Runtime('Variable "property" does not exist.', 22, $this->getSourceContext()); })())); |
||
| 170 | echo "\">"; |
||
| 171 | // line 23 |
||
| 172 | echo $this->env->getExtension('Sami\Renderer\TwigExtension')->abbrClass(twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["property"]) || array_key_exists("property", $context) ? $context["property"] : (function () { throw new Twig_Error_Runtime('Variable "property" does not exist.', 23, $this->getSourceContext()); })()), "class", array())); |
||
| 173 | if ( !((array_key_exists("classonly", $context)) ? (_twig_default_filter((isset($context["classonly"]) || array_key_exists("classonly", $context) ? $context["classonly"] : (function () { throw new Twig_Error_Runtime('Variable "classonly" does not exist.', 23, $this->getSourceContext()); })()), true)) : (true))) { |
||
| 174 | echo "#"; |
||
| 175 | echo twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["property"]) || array_key_exists("property", $context) ? $context["property"] : (function () { throw new Twig_Error_Runtime('Variable "property" does not exist.', 23, $this->getSourceContext()); })()), "name", array()); |
||
| 176 | } |
||
| 177 | // line 24 |
||
| 178 | echo "</a>"; |
||
| 179 | |||
| 180 | return ('' === $tmp = ob_get_contents()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); |
||
| 181 | } finally { |
||
| 182 | ob_end_clean(); |
||
| 183 | } |
||
| 184 | } |
||
| 185 | |||
| 186 | // line 27 |
||
| 187 | public function macro_hint_link($__hints__ = null, ...$__varargs__) |
||
| 188 | { |
||
| 189 | $context = $this->env->mergeGlobals(array( |
||
| 190 | "hints" => $__hints__, |
||
| 191 | "varargs" => $__varargs__, |
||
| 192 | )); |
||
| 193 | |||
| 194 | $blocks = array(); |
||
| 195 | |||
| 196 | ob_start(); |
||
| 197 | try { |
||
| 198 | // line 28 |
||
| 199 | $context["__internal_11b86fda8ebd919c9af0a60177e0d5b57cba2f43be784e41c659847cb36c2ed3"] = $this; |
||
| 200 | // line 30 |
||
| 201 | if ((isset($context["hints"]) || array_key_exists("hints", $context) ? $context["hints"] : (function () { throw new Twig_Error_Runtime('Variable "hints" does not exist.', 30, $this->getSourceContext()); })())) { |
||
| 202 | // line 31 |
||
| 203 | $context['_parent'] = $context; |
||
| 204 | $context['_seq'] = twig_ensure_traversable((isset($context["hints"]) || array_key_exists("hints", $context) ? $context["hints"] : (function () { throw new Twig_Error_Runtime('Variable "hints" does not exist.', 31, $this->getSourceContext()); })())); |
||
| 205 | $context['loop'] = array( |
||
| 206 | 'parent' => $context['_parent'], |
||
| 207 | 'index0' => 0, |
||
| 208 | 'index' => 1, |
||
| 209 | 'first' => true, |
||
| 210 | ); |
||
| 211 | if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof Countable)) { |
||
| 212 | $length = count($context['_seq']); |
||
| 213 | $context['loop']['revindex0'] = $length - 1; |
||
| 214 | $context['loop']['revindex'] = $length; |
||
| 215 | $context['loop']['length'] = $length; |
||
| 216 | $context['loop']['last'] = 1 === $length; |
||
| 217 | } |
||
| 218 | foreach ($context['_seq'] as $context["_key"] => $context["hint"]) { |
||
| 219 | // line 32 |
||
| 220 | if (twig_get_attribute($this->env, $this->getSourceContext(), $context["hint"], "class", array())) { |
||
| 221 | // line 33 |
||
| 222 | echo $context["__internal_11b86fda8ebd919c9af0a60177e0d5b57cba2f43be784e41c659847cb36c2ed3"]->macro_class_link(twig_get_attribute($this->env, $this->getSourceContext(), $context["hint"], "name", array())); |
||
| 223 | } elseif (twig_get_attribute($this->env, $this->getSourceContext(), // line 34 |
||
| 224 | $context["hint"], "name", array())) { |
||
| 225 | // line 35 |
||
| 226 | echo $this->env->getExtension('Sami\Renderer\TwigExtension')->abbrClass(twig_get_attribute($this->env, $this->getSourceContext(), $context["hint"], "name", array())); |
||
| 227 | } |
||
| 228 | // line 37 |
||
| 229 | if (twig_get_attribute($this->env, $this->getSourceContext(), $context["hint"], "array", array())) { |
||
| 230 | echo "[]"; |
||
| 231 | } |
||
| 232 | // line 38 |
||
| 233 | if ( !twig_get_attribute($this->env, $this->getSourceContext(), $context["loop"], "last", array())) { |
||
| 234 | echo "|"; |
||
| 235 | } |
||
| 236 | ++$context['loop']['index0']; |
||
| 237 | ++$context['loop']['index']; |
||
| 238 | $context['loop']['first'] = false; |
||
| 239 | if (isset($context['loop']['length'])) { |
||
| 240 | --$context['loop']['revindex0']; |
||
| 241 | --$context['loop']['revindex']; |
||
| 242 | $context['loop']['last'] = 0 === $context['loop']['revindex0']; |
||
| 243 | } |
||
| 244 | } |
||
| 245 | $_parent = $context['_parent']; |
||
| 246 | unset($context['_seq'], $context['_iterated'], $context['_key'], $context['hint'], $context['_parent'], $context['loop']); |
||
| 247 | $context = array_intersect_key($context, $_parent) + $_parent; |
||
| 248 | } |
||
| 249 | |||
| 250 | return ('' === $tmp = ob_get_contents()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); |
||
| 251 | } finally { |
||
| 252 | ob_end_clean(); |
||
| 253 | } |
||
| 254 | } |
||
| 255 | |||
| 256 | // line 43 |
||
| 257 | public function macro_source_link($__project__ = null, $__class__ = null, ...$__varargs__) |
||
| 258 | { |
||
| 259 | $context = $this->env->mergeGlobals(array( |
||
| 260 | "project" => $__project__, |
||
| 261 | "class" => $__class__, |
||
| 262 | "varargs" => $__varargs__, |
||
| 263 | )); |
||
| 264 | |||
| 265 | $blocks = array(); |
||
| 266 | |||
| 267 | ob_start(); |
||
| 268 | try { |
||
| 269 | // line 44 |
||
| 270 | if (twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["class"]) || array_key_exists("class", $context) ? $context["class"] : (function () { throw new Twig_Error_Runtime('Variable "class" does not exist.', 44, $this->getSourceContext()); })()), "sourcepath", array())) { |
||
| 271 | // line 45 |
||
| 272 | echo " (<a href=\""; |
||
| 273 | echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["class"]) || array_key_exists("class", $context) ? $context["class"] : (function () { throw new Twig_Error_Runtime('Variable "class" does not exist.', 45, $this->getSourceContext()); })()), "sourcepath", array()), "html", null, true); |
||
| 274 | echo "\">View source</a>)"; |
||
| 275 | } |
||
| 276 | |||
| 277 | return ('' === $tmp = ob_get_contents()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); |
||
| 278 | } finally { |
||
| 279 | ob_end_clean(); |
||
| 280 | } |
||
| 281 | } |
||
| 282 | |||
| 283 | // line 49 |
||
| 284 | public function macro_method_source_link($__method__ = null, ...$__varargs__) |
||
| 285 | { |
||
| 286 | $context = $this->env->mergeGlobals(array( |
||
| 287 | "method" => $__method__, |
||
| 288 | "varargs" => $__varargs__, |
||
| 289 | )); |
||
| 290 | |||
| 291 | $blocks = array(); |
||
| 292 | |||
| 293 | ob_start(); |
||
| 294 | try { |
||
| 295 | // line 50 |
||
| 296 | if (twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["method"]) || array_key_exists("method", $context) ? $context["method"] : (function () { throw new Twig_Error_Runtime('Variable "method" does not exist.', 50, $this->getSourceContext()); })()), "sourcepath", array())) { |
||
| 297 | // line 51 |
||
| 298 | echo " <a href=\""; |
||
| 299 | echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["method"]) || array_key_exists("method", $context) ? $context["method"] : (function () { throw new Twig_Error_Runtime('Variable "method" does not exist.', 51, $this->getSourceContext()); })()), "sourcepath", array()), "html", null, true); |
||
| 300 | echo "\">line "; |
||
| 301 | echo twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["method"]) || array_key_exists("method", $context) ? $context["method"] : (function () { throw new Twig_Error_Runtime('Variable "method" does not exist.', 51, $this->getSourceContext()); })()), "line", array()); |
||
| 302 | echo "</a>"; |
||
| 303 | } else { |
||
| 304 | // line 53 |
||
| 305 | echo " line "; |
||
| 306 | echo twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["method"]) || array_key_exists("method", $context) ? $context["method"] : (function () { throw new Twig_Error_Runtime('Variable "method" does not exist.', 53, $this->getSourceContext()); })()), "line", array()); |
||
| 307 | } |
||
| 308 | |||
| 309 | return ('' === $tmp = ob_get_contents()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); |
||
| 310 | } finally { |
||
| 311 | ob_end_clean(); |
||
| 312 | } |
||
| 313 | } |
||
| 314 | |||
| 315 | // line 57 |
||
| 316 | public function macro_abbr_class($__class__ = null, $__absolute__ = null, ...$__varargs__) |
||
| 317 | { |
||
| 318 | $context = $this->env->mergeGlobals(array( |
||
| 319 | "class" => $__class__, |
||
| 320 | "absolute" => $__absolute__, |
||
| 321 | "varargs" => $__varargs__, |
||
| 322 | )); |
||
| 323 | |||
| 324 | $blocks = array(); |
||
| 325 | |||
| 326 | ob_start(); |
||
| 327 | try { |
||
| 328 | // line 58 |
||
| 329 | echo "<abbr title=\""; |
||
| 330 | echo twig_escape_filter($this->env, (isset($context["class"]) || array_key_exists("class", $context) ? $context["class"] : (function () { throw new Twig_Error_Runtime('Variable "class" does not exist.', 58, $this->getSourceContext()); })()), "html", null, true); |
||
| 331 | echo "\">"; |
||
| 332 | echo twig_escape_filter($this->env, ((((array_key_exists("absolute", $context)) ? (_twig_default_filter((isset($context["absolute"]) || array_key_exists("absolute", $context) ? $context["absolute"] : (function () { throw new Twig_Error_Runtime('Variable "absolute" does not exist.', 58, $this->getSourceContext()); })()), false)) : (false))) ? ((isset($context["class"]) || array_key_exists("class", $context) ? $context["class"] : (function () { throw new Twig_Error_Runtime('Variable "class" does not exist.', 58, $this->getSourceContext()); })())) : (twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["class"]) || array_key_exists("class", $context) ? $context["class"] : (function () { throw new Twig_Error_Runtime('Variable "class" does not exist.', 58, $this->getSourceContext()); })()), "shortname", array()))), "html", null, true); |
||
| 333 | echo "</abbr>"; |
||
| 334 | |||
| 335 | return ('' === $tmp = ob_get_contents()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); |
||
| 336 | } finally { |
||
| 337 | ob_end_clean(); |
||
| 338 | } |
||
| 339 | } |
||
| 340 | |||
| 341 | // line 61 |
||
| 342 | public function macro_method_parameters_signature($__method__ = null, ...$__varargs__) |
||
| 343 | { |
||
| 344 | $context = $this->env->mergeGlobals(array( |
||
| 345 | "method" => $__method__, |
||
| 346 | "varargs" => $__varargs__, |
||
| 347 | )); |
||
| 348 | |||
| 349 | $blocks = array(); |
||
| 350 | |||
| 351 | ob_start(); |
||
| 352 | try { |
||
| 353 | // line 62 |
||
| 354 | $context["__internal_20ae0a0cc120a251f44cea8c35de313ad730135e78ea23d1c88d1c3b98637147"] = $this->loadTemplate("macros.twig", "macros.twig", 62); |
||
| 355 | // line 63 |
||
| 356 | echo "("; |
||
| 357 | // line 64 |
||
| 358 | $context['_parent'] = $context; |
||
| 359 | $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["method"]) || array_key_exists("method", $context) ? $context["method"] : (function () { throw new Twig_Error_Runtime('Variable "method" does not exist.', 64, $this->getSourceContext()); })()), "parameters", array())); |
||
| 360 | $context['loop'] = array( |
||
| 361 | 'parent' => $context['_parent'], |
||
| 362 | 'index0' => 0, |
||
| 363 | 'index' => 1, |
||
| 364 | 'first' => true, |
||
| 365 | ); |
||
| 366 | if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof Countable)) { |
||
| 367 | $length = count($context['_seq']); |
||
| 368 | $context['loop']['revindex0'] = $length - 1; |
||
| 369 | $context['loop']['revindex'] = $length; |
||
| 370 | $context['loop']['length'] = $length; |
||
| 371 | $context['loop']['last'] = 1 === $length; |
||
| 372 | } |
||
| 373 | foreach ($context['_seq'] as $context["_key"] => $context["parameter"]) { |
||
| 374 | // line 65 |
||
| 375 | if (twig_get_attribute($this->env, $this->getSourceContext(), $context["parameter"], "hashint", array())) { |
||
| 376 | echo $context["__internal_20ae0a0cc120a251f44cea8c35de313ad730135e78ea23d1c88d1c3b98637147"]->macro_hint_link(twig_get_attribute($this->env, $this->getSourceContext(), $context["parameter"], "hint", array())); |
||
| 377 | echo " "; |
||
| 378 | } |
||
| 379 | // line 66 |
||
| 380 | echo "\$"; |
||
| 381 | echo twig_get_attribute($this->env, $this->getSourceContext(), $context["parameter"], "name", array()); |
||
| 382 | // line 67 |
||
| 383 | if (twig_get_attribute($this->env, $this->getSourceContext(), $context["parameter"], "default", array())) { |
||
| 384 | echo " = "; |
||
| 385 | echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->getSourceContext(), $context["parameter"], "default", array()), "html", null, true); |
||
| 386 | } |
||
| 387 | // line 68 |
||
| 388 | if ( !twig_get_attribute($this->env, $this->getSourceContext(), $context["loop"], "last", array())) { |
||
| 389 | echo ", "; |
||
| 390 | } |
||
| 391 | ++$context['loop']['index0']; |
||
| 392 | ++$context['loop']['index']; |
||
| 393 | $context['loop']['first'] = false; |
||
| 394 | if (isset($context['loop']['length'])) { |
||
| 395 | --$context['loop']['revindex0']; |
||
| 396 | --$context['loop']['revindex']; |
||
| 397 | $context['loop']['last'] = 0 === $context['loop']['revindex0']; |
||
| 398 | } |
||
| 399 | } |
||
| 400 | $_parent = $context['_parent']; |
||
| 401 | unset($context['_seq'], $context['_iterated'], $context['_key'], $context['parameter'], $context['_parent'], $context['loop']); |
||
| 402 | $context = array_intersect_key($context, $_parent) + $_parent; |
||
| 403 | // line 70 |
||
| 404 | echo ")"; |
||
| 405 | |||
| 406 | return ('' === $tmp = ob_get_contents()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); |
||
| 407 | } finally { |
||
| 408 | ob_end_clean(); |
||
| 409 | } |
||
| 410 | } |
||
| 411 | |||
| 412 | // line 73 |
||
| 413 | public function macro_render_classes($__classes__ = null, ...$__varargs__) |
||
| 414 | { |
||
| 415 | $context = $this->env->mergeGlobals(array( |
||
| 416 | "classes" => $__classes__, |
||
| 417 | "varargs" => $__varargs__, |
||
| 418 | )); |
||
| 419 | |||
| 420 | $blocks = array(); |
||
| 421 | |||
| 422 | ob_start(); |
||
| 423 | try { |
||
| 424 | // line 74 |
||
| 425 | $context["__internal_0dcd0a0de11e9257248e7316cba8cbce297dfcfa69d4372e15bca2c48d7d6eaa"] = $this; |
||
| 426 | // line 75 |
||
| 427 | echo " |
||
| 428 | <div class=\"container-fluid underlined\"> |
||
| 429 | "; |
||
| 430 | // line 77 |
||
| 431 | $context['_parent'] = $context; |
||
| 432 | $context['_seq'] = twig_ensure_traversable((isset($context["classes"]) || array_key_exists("classes", $context) ? $context["classes"] : (function () { throw new Twig_Error_Runtime('Variable "classes" does not exist.', 77, $this->getSourceContext()); })())); |
||
| 433 | foreach ($context['_seq'] as $context["_key"] => $context["class"]) { |
||
| 434 | // line 78 |
||
| 435 | echo " <div class=\"row\"> |
||
| 436 | <div class=\"col-md-6\"> |
||
| 437 | "; |
||
| 438 | // line 80 |
||
| 439 | if (twig_get_attribute($this->env, $this->getSourceContext(), $context["class"], "isInterface", array())) { |
||
| 440 | // line 81 |
||
| 441 | echo " <em>"; |
||
| 442 | echo $context["__internal_0dcd0a0de11e9257248e7316cba8cbce297dfcfa69d4372e15bca2c48d7d6eaa"]->macro_class_link($context["class"], true); |
||
| 443 | echo "</em> |
||
| 444 | "; |
||
| 445 | } else { |
||
| 446 | // line 83 |
||
| 447 | echo " "; |
||
| 448 | echo $context["__internal_0dcd0a0de11e9257248e7316cba8cbce297dfcfa69d4372e15bca2c48d7d6eaa"]->macro_class_link($context["class"], true); |
||
| 449 | echo " |
||
| 450 | "; |
||
| 451 | } |
||
| 452 | // line 85 |
||
| 453 | echo " "; |
||
| 454 | echo $context["__internal_0dcd0a0de11e9257248e7316cba8cbce297dfcfa69d4372e15bca2c48d7d6eaa"]->macro_deprecated($context["class"]); |
||
| 455 | echo " |
||
| 456 | </div> |
||
| 457 | <div class=\"col-md-6\"> |
||
| 458 | "; |
||
| 459 | // line 88 |
||
| 460 | echo $this->env->getExtension('Sami\Renderer\TwigExtension')->parseDesc($context, twig_get_attribute($this->env, $this->getSourceContext(), $context["class"], "shortdesc", array()), $context["class"]); |
||
| 461 | echo " |
||
| 462 | </div> |
||
| 463 | </div> |
||
| 464 | "; |
||
| 465 | } |
||
| 466 | $_parent = $context['_parent']; |
||
| 467 | unset($context['_seq'], $context['_iterated'], $context['_key'], $context['class'], $context['_parent'], $context['loop']); |
||
| 468 | $context = array_intersect_key($context, $_parent) + $_parent; |
||
| 469 | // line 92 |
||
| 470 | echo " </div>"; |
||
| 471 | |||
| 472 | return ('' === $tmp = ob_get_contents()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); |
||
| 473 | } finally { |
||
| 474 | ob_end_clean(); |
||
| 475 | } |
||
| 476 | } |
||
| 477 | |||
| 478 | // line 95 |
||
| 479 | public function macro_breadcrumbs($__namespace__ = null, ...$__varargs__) |
||
| 480 | { |
||
| 481 | $context = $this->env->mergeGlobals(array( |
||
| 482 | "namespace" => $__namespace__, |
||
| 483 | "varargs" => $__varargs__, |
||
| 484 | )); |
||
| 485 | |||
| 486 | $blocks = array(); |
||
| 487 | |||
| 488 | ob_start(); |
||
| 489 | try { |
||
| 490 | // line 96 |
||
| 491 | echo " "; |
||
| 492 | $context["current_ns"] = ""; |
||
| 493 | // line 97 |
||
| 494 | echo " "; |
||
| 495 | $context['_parent'] = $context; |
||
| 496 | $context['_seq'] = twig_ensure_traversable(twig_split_filter($this->env, (isset($context["namespace"]) || array_key_exists("namespace", $context) ? $context["namespace"] : (function () { throw new Twig_Error_Runtime('Variable "namespace" does not exist.', 97, $this->getSourceContext()); })()), "\\")); |
||
| 497 | foreach ($context['_seq'] as $context["_key"] => $context["ns"]) { |
||
| 498 | // line 98 |
||
| 499 | echo " "; |
||
| 500 | if ((isset($context["current_ns"]) || array_key_exists("current_ns", $context) ? $context["current_ns"] : (function () { throw new Twig_Error_Runtime('Variable "current_ns" does not exist.', 98, $this->getSourceContext()); })())) { |
||
| 501 | // line 99 |
||
| 502 | echo " "; |
||
| 503 | $context["current_ns"] = (((isset($context["current_ns"]) || array_key_exists("current_ns", $context) ? $context["current_ns"] : (function () { throw new Twig_Error_Runtime('Variable "current_ns" does not exist.', 99, $this->getSourceContext()); })()) . "\\") . $context["ns"]); |
||
| 504 | // line 100 |
||
| 505 | echo " "; |
||
| 506 | } else { |
||
| 507 | // line 101 |
||
| 508 | echo " "; |
||
| 509 | $context["current_ns"] = $context["ns"]; |
||
| 510 | // line 102 |
||
| 511 | echo " "; |
||
| 512 | } |
||
| 513 | // line 103 |
||
| 514 | echo " <li><a href=\""; |
||
| 515 | echo $this->env->getExtension('Sami\Renderer\TwigExtension')->pathForNamespace($context, (isset($context["current_ns"]) || array_key_exists("current_ns", $context) ? $context["current_ns"] : (function () { throw new Twig_Error_Runtime('Variable "current_ns" does not exist.', 103, $this->getSourceContext()); })())); |
||
| 516 | echo "\">"; |
||
| 517 | echo $context["ns"]; |
||
| 518 | echo "</a></li> |
||
| 519 | "; |
||
| 520 | } |
||
| 521 | $_parent = $context['_parent']; |
||
| 522 | unset($context['_seq'], $context['_iterated'], $context['_key'], $context['ns'], $context['_parent'], $context['loop']); |
||
| 523 | $context = array_intersect_key($context, $_parent) + $_parent; |
||
| 524 | |||
| 525 | return ('' === $tmp = ob_get_contents()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); |
||
| 526 | } finally { |
||
| 527 | ob_end_clean(); |
||
| 528 | } |
||
| 529 | } |
||
| 530 | |||
| 531 | // line 107 |
||
| 532 | public function macro_deprecated($__reflection__ = null, ...$__varargs__) |
||
| 533 | { |
||
| 534 | $context = $this->env->mergeGlobals(array( |
||
| 535 | "reflection" => $__reflection__, |
||
| 536 | "varargs" => $__varargs__, |
||
| 537 | )); |
||
| 538 | |||
| 539 | $blocks = array(); |
||
| 540 | |||
| 541 | ob_start(); |
||
| 542 | try { |
||
| 543 | // line 108 |
||
| 544 | echo " "; |
||
| 545 | if (twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["reflection"]) || array_key_exists("reflection", $context) ? $context["reflection"] : (function () { throw new Twig_Error_Runtime('Variable "reflection" does not exist.', 108, $this->getSourceContext()); })()), "deprecated", array())) { |
||
| 546 | echo "<small><sup><span class=\"label label-danger\">deprecated</span></sup></small>"; |
||
| 547 | } |
||
| 548 | |||
| 549 | return ('' === $tmp = ob_get_contents()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); |
||
| 550 | } finally { |
||
| 551 | ob_end_clean(); |
||
| 552 | } |
||
| 553 | } |
||
| 554 | |||
| 555 | // line 111 |
||
| 556 | public function macro_deprecations($__reflection__ = null, ...$__varargs__) |
||
| 557 | { |
||
| 558 | $context = $this->env->mergeGlobals(array( |
||
| 559 | "reflection" => $__reflection__, |
||
| 560 | "varargs" => $__varargs__, |
||
| 561 | )); |
||
| 562 | |||
| 563 | $blocks = array(); |
||
| 564 | |||
| 565 | ob_start(); |
||
| 566 | try { |
||
| 567 | // line 112 |
||
| 568 | echo " "; |
||
| 569 | $context["__internal_0b6812856cc304260898be8fa8c37360a3feb2053dd47484c7b92e756edf83ce"] = $this; |
||
| 570 | // line 113 |
||
| 571 | echo " |
||
| 572 | "; |
||
| 573 | // line 114 |
||
| 574 | if (twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["reflection"]) || array_key_exists("reflection", $context) ? $context["reflection"] : (function () { throw new Twig_Error_Runtime('Variable "reflection" does not exist.', 114, $this->getSourceContext()); })()), "deprecated", array())) { |
||
| 575 | // line 115 |
||
| 576 | echo " <p> |
||
| 577 | "; |
||
| 578 | // line 116 |
||
| 579 | echo $context["__internal_0b6812856cc304260898be8fa8c37360a3feb2053dd47484c7b92e756edf83ce"]->macro_deprecated((isset($context["reflection"]) || array_key_exists("reflection", $context) ? $context["reflection"] : (function () { throw new Twig_Error_Runtime('Variable "reflection" does not exist.', 116, $this->getSourceContext()); })())); |
||
| 580 | echo " |
||
| 581 | "; |
||
| 582 | // line 117 |
||
| 583 | $context['_parent'] = $context; |
||
| 584 | $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["reflection"]) || array_key_exists("reflection", $context) ? $context["reflection"] : (function () { throw new Twig_Error_Runtime('Variable "reflection" does not exist.', 117, $this->getSourceContext()); })()), "deprecated", array())); |
||
| 585 | foreach ($context['_seq'] as $context["_key"] => $context["tag"]) { |
||
| 586 | // line 118 |
||
| 587 | echo " <tr> |
||
| 588 | <td>"; |
||
| 589 | // line 119 |
||
| 590 | echo twig_get_attribute($this->env, $this->getSourceContext(), $context["tag"], 0, array(), "array"); |
||
| 591 | echo "</td> |
||
| 592 | <td>"; |
||
| 593 | // line 120 |
||
| 594 | echo twig_join_filter(twig_slice($this->env, $context["tag"], 1, null), " "); |
||
| 595 | echo "</td> |
||
| 596 | </tr> |
||
| 597 | "; |
||
| 598 | } |
||
| 599 | $_parent = $context['_parent']; |
||
| 600 | unset($context['_seq'], $context['_iterated'], $context['_key'], $context['tag'], $context['_parent'], $context['loop']); |
||
| 601 | $context = array_intersect_key($context, $_parent) + $_parent; |
||
| 602 | // line 123 |
||
| 603 | echo " </p> |
||
| 604 | "; |
||
| 605 | } |
||
| 606 | |||
| 607 | return ('' === $tmp = ob_get_contents()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); |
||
| 608 | } finally { |
||
| 609 | ob_end_clean(); |
||
| 610 | } |
||
| 611 | } |
||
| 612 | |||
| 613 | public function getTemplateName() |
||
| 614 | { |
||
| 615 | return "macros.twig"; |
||
| 616 | } |
||
| 617 | |||
| 618 | public function isTraitable() |
||
| 619 | { |
||
| 620 | return false; |
||
| 621 | } |
||
| 622 | |||
| 623 | public function getDebugInfo() |
||
| 624 | { |
||
| 625 | return array ( 603 => 123, 594 => 120, 590 => 119, 587 => 118, 583 => 117, 579 => 116, 576 => 115, 574 => 114, 571 => 113, 568 => 112, 556 => 111, 544 => 108, 532 => 107, 514 => 103, 511 => 102, 508 => 101, 505 => 100, 502 => 99, 499 => 98, 494 => 97, 491 => 96, 479 => 95, 470 => 92, 460 => 88, 453 => 85, 447 => 83, 441 => 81, 439 => 80, 435 => 78, 431 => 77, 427 => 75, 425 => 74, 413 => 73, 404 => 70, 388 => 68, 383 => 67, 380 => 66, 375 => 65, 358 => 64, 356 => 63, 354 => 62, 342 => 61, 329 => 58, 316 => 57, 305 => 53, 298 => 51, 296 => 50, 284 => 49, 272 => 45, 270 => 44, 257 => 43, 233 => 38, 229 => 37, 226 => 35, 224 => 34, 222 => 33, 220 => 32, 203 => 31, 201 => 30, 199 => 28, 187 => 27, 178 => 24, 172 => 23, 168 => 22, 154 => 21, 145 => 18, 139 => 17, 135 => 16, 121 => 15, 110 => 12, 108 => 11, 103 => 9, 101 => 8, 97 => 7, 95 => 6, 82 => 5, 69 => 2, 57 => 1, 52 => 110, 49 => 106, 46 => 94, 43 => 72, 40 => 60, 37 => 56, 34 => 48, 31 => 42, 28 => 26, 25 => 20, 22 => 14, 19 => 4,); |
||
| 626 | } |
||
| 627 | |||
| 628 | public function getSourceContext() |
||
| 629 | { |
||
| 630 | return new Twig_Source("{% macro namespace_link(namespace) -%} |
||
| 631 | <a href=\"{{ namespace_path(namespace) }}\">{{ namespace|raw }}</a> |
||
| 632 | {%- endmacro %} |
||
| 633 | |||
| 634 | {% macro class_link(class, absolute) -%} |
||
| 635 | {%- if class.projectclass -%} |
||
| 636 | <a href=\"{{ class_path(class) }}\"> |
||
| 637 | {%- elseif class.phpclass -%} |
||
| 638 | <a target=\"_blank\" href=\"http://php.net/{{ class|raw }}\"> |
||
| 639 | {%- endif %} |
||
| 640 | {{- abbr_class(class, absolute|default(false)) }} |
||
| 641 | {%- if class.projectclass or class.phpclass %}</a>{% endif %} |
||
| 642 | {%- endmacro %} |
||
| 643 | |||
| 644 | {% macro method_link(method, absolute, classonly) -%} |
||
| 645 | <a href=\"{{ method_path(method) }}\"> |
||
| 646 | {{- abbr_class(method.class) }}{% if not classonly|default(false) %}::{{ method.name|raw }}{% endif -%} |
||
| 647 | </a> |
||
| 648 | {%- endmacro %} |
||
| 649 | |||
| 650 | {% macro property_link(property, absolute, classonly) -%} |
||
| 651 | <a href=\"{{ property_path(property) }}\"> |
||
| 652 | {{- abbr_class(property.class) }}{% if not classonly|default(true) %}#{{ property.name|raw }}{% endif -%} |
||
| 653 | </a> |
||
| 654 | {%- endmacro %} |
||
| 655 | |||
| 656 | {% macro hint_link(hints) -%} |
||
| 657 | {%- from _self import class_link %} |
||
| 658 | |||
| 659 | {%- if hints %} |
||
| 660 | {%- for hint in hints %} |
||
| 661 | {%- if hint.class %} |
||
| 662 | {{- class_link(hint.name) }} |
||
| 663 | {%- elseif hint.name %} |
||
| 664 | {{- abbr_class(hint.name) }} |
||
| 665 | {%- endif %} |
||
| 666 | {%- if hint.array %}[]{% endif %} |
||
| 667 | {%- if not loop.last %}|{% endif %} |
||
| 668 | {%- endfor %} |
||
| 669 | {%- endif %} |
||
| 670 | {%- endmacro %} |
||
| 671 | |||
| 672 | {% macro source_link(project, class) -%} |
||
| 673 | {% if class.sourcepath %} |
||
| 674 | (<a href=\"{{ class.sourcepath }}\">View source</a>) |
||
| 675 | {%- endif %} |
||
| 676 | {%- endmacro %} |
||
| 677 | |||
| 678 | {% macro method_source_link(method) -%} |
||
| 679 | {% if method.sourcepath %} |
||
| 680 | <a href=\"{{ method.sourcepath }}\">line {{ method.line|raw }}</a> |
||
| 681 | {%- else %} |
||
| 682 | line {{ method.line|raw }} |
||
| 683 | {%- endif %} |
||
| 684 | {%- endmacro %} |
||
| 685 | |||
| 686 | {% macro abbr_class(class, absolute) -%} |
||
| 687 | <abbr title=\"{{ class }}\">{{ absolute|default(false) ? class : class.shortname }}</abbr> |
||
| 688 | {%- endmacro %} |
||
| 689 | |||
| 690 | {% macro method_parameters_signature(method) -%} |
||
| 691 | {%- from \"macros.twig\" import hint_link -%} |
||
| 692 | ( |
||
| 693 | {%- for parameter in method.parameters %} |
||
| 694 | {%- if parameter.hashint %}{{ hint_link(parameter.hint) }} {% endif -%} |
||
| 695 | \${{ parameter.name|raw }} |
||
| 696 | {%- if parameter.default %} = {{ parameter.default }}{% endif %} |
||
| 697 | {%- if not loop.last %}, {% endif %} |
||
| 698 | {%- endfor -%} |
||
| 699 | ) |
||
| 700 | {%- endmacro %} |
||
| 701 | |||
| 702 | {% macro render_classes(classes) -%} |
||
| 703 | {% from _self import class_link, deprecated %} |
||
| 704 | |||
| 705 | <div class=\"container-fluid underlined\"> |
||
| 706 | {% for class in classes %} |
||
| 707 | <div class=\"row\"> |
||
| 708 | <div class=\"col-md-6\"> |
||
| 709 | {% if class.isInterface %} |
||
| 710 | <em>{{ class_link(class, true) }}</em> |
||
| 711 | {% else %} |
||
| 712 | {{ class_link(class, true) }} |
||
| 713 | {% endif %} |
||
| 714 | {{ deprecated(class) }} |
||
| 715 | </div> |
||
| 716 | <div class=\"col-md-6\"> |
||
| 717 | {{ class.shortdesc|desc(class) }} |
||
| 718 | </div> |
||
| 719 | </div> |
||
| 720 | {% endfor %} |
||
| 721 | </div> |
||
| 722 | {%- endmacro %} |
||
| 723 | |||
| 724 | {% macro breadcrumbs(namespace) %} |
||
| 725 | {% set current_ns = '' %} |
||
| 726 | {% for ns in namespace|split('\\\\') %} |
||
| 727 | {% if current_ns %} |
||
| 728 | {% set current_ns = current_ns ~ '\\\\' ~ ns %} |
||
| 729 | {% else %} |
||
| 730 | {% set current_ns = ns %} |
||
| 731 | {% endif %} |
||
| 732 | <li><a href=\"{{ namespace_path(current_ns) }}\">{{ ns|raw }}</a></li> |
||
| 733 | {% endfor %} |
||
| 734 | {% endmacro %} |
||
| 735 | |||
| 736 | {% macro deprecated(reflection) %} |
||
| 737 | {% if reflection.deprecated %}<small><sup><span class=\"label label-danger\">deprecated</span></sup></small>{% endif %} |
||
| 738 | {% endmacro %} |
||
| 739 | |||
| 740 | {% macro deprecations(reflection) %} |
||
| 741 | {% from _self import deprecated %} |
||
| 742 | |||
| 743 | {% if reflection.deprecated %} |
||
| 744 | <p> |
||
| 745 | {{ deprecated(reflection )}} |
||
| 746 | {% for tag in reflection.deprecated %} |
||
| 747 | <tr> |
||
| 748 | <td>{{ tag[0]|raw }}</td> |
||
| 749 | <td>{{ tag[1:]|join(' ')|raw }}</td> |
||
| 750 | </tr> |
||
| 751 | {% endfor %} |
||
| 752 | </p> |
||
| 753 | {% endif %} |
||
| 754 | {% endmacro %} |
||
| 755 | ", "macros.twig", "phar:///Users/bobby/Dropbox/Sites/OpenSource/Slackify/sami.phar/Sami/Resources/themes/default/macros.twig"); |
||
| 756 | } |
||
| 757 | } |
||
| 758 |