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:
| 1 | <?php |
||
| 4 | class __TwigTemplate_5f95a19555690cb88661cd477e3eba8bde60f0ae5b9c972d3ed09b68ecf4bf68 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 | 'title' => array($this, 'block_title'), |
||
| 14 | 'head' => array($this, 'block_head'), |
||
| 15 | 'html' => array($this, 'block_html'), |
||
| 16 | 'body_class' => array($this, 'block_body_class'), |
||
| 17 | 'page_id' => array($this, 'block_page_id'), |
||
| 18 | 'content' => array($this, 'block_content'), |
||
| 19 | ); |
||
| 20 | } |
||
| 21 | |||
| 22 | protected function doDisplay(array $context, array $blocks = array()) |
||
| 23 | { |
||
| 24 | // line 1 |
||
| 25 | echo "<!DOCTYPE html> |
||
| 26 | <html lang=\"en\"> |
||
| 27 | <head> |
||
| 28 | <meta charset=\"UTF-8\" /> |
||
| 29 | <meta name=\"robots\" content=\"index, follow, all\" /> |
||
| 30 | <title>"; |
||
| 31 | // line 6 |
||
| 32 | $this->displayBlock('title', $context, $blocks); |
||
| 33 | echo "</title> |
||
| 34 | |||
| 35 | "; |
||
| 36 | // line 8 |
||
| 37 | $this->displayBlock('head', $context, $blocks); |
||
| 38 | // line 20 |
||
| 39 | echo " |
||
| 40 | "; |
||
| 41 | // line 21 |
||
| 42 | if (twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["project"]) || array_key_exists("project", $context) ? $context["project"] : (function () { throw new Twig_Error_Runtime('Variable "project" does not exist.', 21, $this->getSourceContext()); })()), "config", array(0 => "favicon"), "method")) { |
||
| 43 | // line 22 |
||
| 44 | echo " <link rel=\"shortcut icon\" href=\""; |
||
| 45 | echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["project"]) || array_key_exists("project", $context) ? $context["project"] : (function () { throw new Twig_Error_Runtime('Variable "project" does not exist.', 22, $this->getSourceContext()); })()), "config", array(0 => "favicon"), "method"), "html", null, true); |
||
| 46 | echo "\" /> |
||
| 47 | "; |
||
| 48 | } |
||
| 49 | // line 24 |
||
| 50 | echo " |
||
| 51 | "; |
||
| 52 | // line 25 |
||
| 53 | if (twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["project"]) || array_key_exists("project", $context) ? $context["project"] : (function () { throw new Twig_Error_Runtime('Variable "project" does not exist.', 25, $this->getSourceContext()); })()), "config", array(0 => "base_url"), "method")) { |
||
| 54 | // line 26 |
||
| 55 | $context['_parent'] = $context; |
||
| 56 | $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["project"]) || array_key_exists("project", $context) ? $context["project"] : (function () { throw new Twig_Error_Runtime('Variable "project" does not exist.', 26, $this->getSourceContext()); })()), "versions", array())); |
||
| 57 | foreach ($context['_seq'] as $context["_key"] => $context["version"]) { |
||
| 58 | // line 27 |
||
| 59 | echo "<link rel=\"search\" |
||
| 60 | type=\"application/opensearchdescription+xml\" |
||
| 61 | href=\""; |
||
| 62 | // line 29 |
||
| 63 | echo twig_escape_filter($this->env, twig_replace_filter(twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["project"]) || array_key_exists("project", $context) ? $context["project"] : (function () { throw new Twig_Error_Runtime('Variable "project" does not exist.', 29, $this->getSourceContext()); })()), "config", array(0 => "base_url"), "method"), array("%version%" => $context["version"])), "html", null, true); |
||
| 64 | echo "/opensearch.xml\" |
||
| 65 | title=\""; |
||
| 66 | // line 30 |
||
| 67 | echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["project"]) || array_key_exists("project", $context) ? $context["project"] : (function () { throw new Twig_Error_Runtime('Variable "project" does not exist.', 30, $this->getSourceContext()); })()), "config", array(0 => "title"), "method"), "html", null, true); |
||
| 68 | echo " ("; |
||
| 69 | echo twig_escape_filter($this->env, $context["version"], "html", null, true); |
||
| 70 | echo ")\" /> |
||
| 71 | "; |
||
| 72 | } |
||
| 73 | $_parent = $context['_parent']; |
||
| 74 | unset($context['_seq'], $context['_iterated'], $context['_key'], $context['version'], $context['_parent'], $context['loop']); |
||
| 75 | $context = array_intersect_key($context, $_parent) + $_parent; |
||
| 76 | } |
||
| 77 | // line 33 |
||
| 78 | echo "</head> |
||
| 79 | |||
| 80 | "; |
||
| 81 | // line 35 |
||
| 82 | $this->displayBlock('html', $context, $blocks); |
||
| 83 | // line 40 |
||
| 84 | echo " |
||
| 85 | </html> |
||
| 86 | "; |
||
| 87 | } |
||
| 88 | |||
| 89 | // line 6 |
||
| 90 | public function block_title($context, array $blocks = array()) |
||
| 91 | { |
||
| 92 | echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["project"]) || array_key_exists("project", $context) ? $context["project"] : (function () { throw new Twig_Error_Runtime('Variable "project" does not exist.', 6, $this->getSourceContext()); })()), "config", array(0 => "title"), "method"), "html", null, true); |
||
| 93 | } |
||
| 94 | |||
| 95 | // line 8 |
||
| 96 | public function block_head($context, array $blocks = array()) |
||
| 97 | { |
||
| 98 | // line 9 |
||
| 99 | echo " <link rel=\"stylesheet\" type=\"text/css\" href=\""; |
||
| 100 | echo twig_escape_filter($this->env, $this->env->getExtension('Sami\Renderer\TwigExtension')->pathForStaticFile($context, "css/bootstrap.min.css"), "html", null, true); |
||
| 101 | echo "\"> |
||
| 102 | <link rel=\"stylesheet\" type=\"text/css\" href=\""; |
||
| 103 | // line 10 |
||
| 104 | echo twig_escape_filter($this->env, $this->env->getExtension('Sami\Renderer\TwigExtension')->pathForStaticFile($context, "css/bootstrap-theme.min.css"), "html", null, true); |
||
| 105 | echo "\"> |
||
| 106 | <link rel=\"stylesheet\" type=\"text/css\" href=\""; |
||
| 107 | // line 11 |
||
| 108 | echo twig_escape_filter($this->env, $this->env->getExtension('Sami\Renderer\TwigExtension')->pathForStaticFile($context, "css/sami.css"), "html", null, true); |
||
| 109 | echo "\"> |
||
| 110 | <script src=\""; |
||
| 111 | // line 12 |
||
| 112 | echo twig_escape_filter($this->env, $this->env->getExtension('Sami\Renderer\TwigExtension')->pathForStaticFile($context, "js/jquery-1.11.1.min.js"), "html", null, true); |
||
| 113 | echo "\"></script> |
||
| 114 | <script src=\""; |
||
| 115 | // line 13 |
||
| 116 | echo twig_escape_filter($this->env, $this->env->getExtension('Sami\Renderer\TwigExtension')->pathForStaticFile($context, "js/bootstrap.min.js"), "html", null, true); |
||
| 117 | echo "\"></script> |
||
| 118 | <script src=\""; |
||
| 119 | // line 14 |
||
| 120 | echo twig_escape_filter($this->env, $this->env->getExtension('Sami\Renderer\TwigExtension')->pathForStaticFile($context, "js/typeahead.min.js"), "html", null, true); |
||
| 121 | echo "\"></script> |
||
| 122 | <script src=\""; |
||
| 123 | // line 15 |
||
| 124 | echo twig_escape_filter($this->env, $this->env->getExtension('Sami\Renderer\TwigExtension')->pathForStaticFile($context, "sami.js"), "html", null, true); |
||
| 125 | echo "\"></script> |
||
| 126 | <meta name=\"MobileOptimized\" content=\"width\"> |
||
| 127 | <meta name=\"HandheldFriendly\" content=\"true\"> |
||
| 128 | <meta name=\"viewport\" content=\"width=device-width,initial-scale=1,maximum-scale=1\"> |
||
| 129 | "; |
||
| 130 | } |
||
| 131 | |||
| 132 | // line 35 |
||
| 133 | public function block_html($context, array $blocks = array()) |
||
| 134 | { |
||
| 135 | // line 36 |
||
| 136 | echo " <body id=\""; |
||
| 137 | $this->displayBlock('body_class', $context, $blocks); |
||
| 138 | echo "\" data-name=\""; |
||
| 139 | $this->displayBlock('page_id', $context, $blocks); |
||
| 140 | echo "\" data-root-path=\""; |
||
| 141 | echo twig_escape_filter($this->env, (isset($context["root_path"]) || array_key_exists("root_path", $context) ? $context["root_path"] : (function () { throw new Twig_Error_Runtime('Variable "root_path" does not exist.', 36, $this->getSourceContext()); })()), "html", null, true); |
||
| 142 | echo "\"> |
||
| 143 | "; |
||
| 144 | // line 37 |
||
| 145 | $this->displayBlock('content', $context, $blocks); |
||
| 146 | // line 38 |
||
| 147 | echo " </body> |
||
| 148 | "; |
||
| 149 | } |
||
| 150 | |||
| 151 | // line 36 |
||
| 152 | public function block_body_class($context, array $blocks = array()) |
||
| 153 | { |
||
| 154 | echo ""; |
||
| 155 | } |
||
| 156 | |||
| 157 | public function block_page_id($context, array $blocks = array()) |
||
| 158 | { |
||
| 159 | echo ""; |
||
| 160 | } |
||
| 161 | |||
| 162 | // line 37 |
||
| 163 | public function block_content($context, array $blocks = array()) |
||
| 164 | { |
||
| 165 | echo ""; |
||
| 166 | } |
||
| 167 | |||
| 168 | public function getTemplateName() |
||
| 169 | { |
||
| 170 | return "layout/base.twig"; |
||
| 171 | } |
||
| 172 | |||
| 173 | public function isTraitable() |
||
| 174 | { |
||
| 175 | return false; |
||
| 176 | } |
||
| 177 | |||
| 178 | public function getDebugInfo() |
||
| 179 | { |
||
| 180 | return array ( 163 => 37, 152 => 36, 147 => 38, 145 => 37, 136 => 36, 133 => 35, 124 => 15, 120 => 14, 116 => 13, 112 => 12, 108 => 11, 104 => 10, 99 => 9, 96 => 8, 90 => 6, 84 => 40, 82 => 35, 78 => 33, 67 => 30, 63 => 29, 59 => 27, 55 => 26, 53 => 25, 50 => 24, 44 => 22, 42 => 21, 39 => 20, 37 => 8, 32 => 6, 25 => 1,); |
||
| 181 | } |
||
| 182 | |||
| 183 | public function getSourceContext() |
||
| 184 | { |
||
| 185 | return new Twig_Source("<!DOCTYPE html> |
||
| 186 | <html lang=\"en\"> |
||
| 187 | <head> |
||
| 188 | <meta charset=\"UTF-8\" /> |
||
| 189 | <meta name=\"robots\" content=\"index, follow, all\" /> |
||
| 190 | <title>{% block title project.config('title') %}</title> |
||
| 191 | |||
| 192 | {% block head %} |
||
| 193 | <link rel=\"stylesheet\" type=\"text/css\" href=\"{{ path('css/bootstrap.min.css') }}\"> |
||
| 194 | <link rel=\"stylesheet\" type=\"text/css\" href=\"{{ path('css/bootstrap-theme.min.css') }}\"> |
||
| 195 | <link rel=\"stylesheet\" type=\"text/css\" href=\"{{ path('css/sami.css') }}\"> |
||
| 196 | <script src=\"{{ path('js/jquery-1.11.1.min.js') }}\"></script> |
||
| 197 | <script src=\"{{ path('js/bootstrap.min.js') }}\"></script> |
||
| 198 | <script src=\"{{ path('js/typeahead.min.js') }}\"></script> |
||
| 199 | <script src=\"{{ path('sami.js') }}\"></script> |
||
| 200 | <meta name=\"MobileOptimized\" content=\"width\"> |
||
| 201 | <meta name=\"HandheldFriendly\" content=\"true\"> |
||
| 202 | <meta name=\"viewport\" content=\"width=device-width,initial-scale=1,maximum-scale=1\"> |
||
| 203 | {% endblock %} |
||
| 204 | |||
| 205 | {% if project.config('favicon') %} |
||
| 206 | <link rel=\"shortcut icon\" href=\"{{ project.config('favicon') }}\" /> |
||
| 207 | {% endif %} |
||
| 208 | |||
| 209 | {% if project.config('base_url') %} |
||
| 210 | {%- for version in project.versions -%} |
||
| 211 | <link rel=\"search\" |
||
| 212 | type=\"application/opensearchdescription+xml\" |
||
| 213 | href=\"{{ project.config('base_url')|replace({'%version%': version}) }}/opensearch.xml\" |
||
| 214 | title=\"{{ project.config('title') }} ({{ version }})\" /> |
||
| 215 | {% endfor -%} |
||
| 216 | {% endif %} |
||
| 217 | </head> |
||
| 218 | |||
| 219 | {% block html %} |
||
| 220 | <body id=\"{% block body_class '' %}\" data-name=\"{% block page_id '' %}\" data-root-path=\"{{ root_path }}\"> |
||
| 221 | {% block content '' %} |
||
| 222 | </body> |
||
| 223 | {% endblock %} |
||
| 224 | |||
| 225 | </html> |
||
| 226 | ", "layout/base.twig", "phar:///Users/bobby/Dropbox/Sites/OpenSource/Slackify/sami.phar/Sami/Resources/themes/default/layout/base.twig"); |
||
| 227 | } |
||
| 228 | } |
||
| 229 |