GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Branch master (e39385)
by Romain
03:56
created

__TwigTemplate_9ed5ad35b12f734b4f1460a4c46f927a638cca26e2b3cac7b371d06ed8e6913e   B

Complexity

Total Complexity 41

Size/Duplication

Total Lines 206
Duplicated Lines 13.11 %

Coupling/Cohesion

Components 2
Dependencies 3

Importance

Changes 0
Metric Value
wmc 41
lcom 2
cbo 3
dl 27
loc 206
rs 8.2769
c 0
b 0
f 0

How to fix   Duplicated Code    Complexity   

Duplicated Code

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 Class

 Tip:   Before tackling complexity, make sure that you eliminate any duplication first. This often can reduce the size of classes significantly.

Complex classes like __TwigTemplate_9ed5ad35b12f734b4f1460a4c46f927a638cca26e2b3cac7b371d06ed8e6913e 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_9ed5ad35b12f734b4f1460a4c46f927a638cca26e2b3cac7b371d06ed8e6913e, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
/* namespace.twig */
4
class __TwigTemplate_9ed5ad35b12f734b4f1460a4c46f927a638cca26e2b3cac7b371d06ed8e6913e extends Twig_Template
5
{
6
    public function __construct(Twig_Environment $env)
7
    {
8
        parent::__construct($env);
9
10
        // line 1
11
        $this->parent = $this->loadTemplate("layout/layout.twig", "namespace.twig", 1);
12
        $this->blocks = array(
13
            'title' => array($this, 'block_title'),
14
            'body_class' => array($this, 'block_body_class'),
15
            'page_id' => array($this, 'block_page_id'),
16
            'below_menu' => array($this, 'block_below_menu'),
17
            'page_content' => array($this, 'block_page_content'),
18
        );
19
    }
20
21
    protected function doGetParent(array $context)
22
    {
23
        return "layout/layout.twig";
24
    }
25
26
    protected function doDisplay(array $context, array $blocks = array())
27
    {
28
        // line 2
29
        $context["__internal_084c0a9b4751f3912921b1f087047d19c4c1f20b347dd6cee5246a93c0cb9eed"] = $this->loadTemplate("macros.twig", "namespace.twig", 2);
30
        // line 1
31
        $this->parent->display($context, array_merge($this->blocks, $blocks));
32
    }
33
34
    // line 3
35
    public function block_title($context, array $blocks = array())
36
    {
37
        echo (isset($context["namespace"]) || array_key_exists("namespace", $context) ? $context["namespace"] : (function () { throw new Twig_Error_Runtime('Variable "namespace" does not exist.', 3, $this->getSourceContext()); })());
38
        echo " | ";
39
        $this->displayParentBlock("title", $context, $blocks);
40
    }
41
42
    // line 4
43
    public function block_body_class($context, array $blocks = array())
44
    {
45
        echo "namespace";
46
    }
47
48
    // line 5
49
    public function block_page_id($context, array $blocks = array())
50
    {
51
        echo twig_escape_filter($this->env, ("namespace:" . twig_replace_filter((isset($context["namespace"]) || array_key_exists("namespace", $context) ? $context["namespace"] : (function () { throw new Twig_Error_Runtime('Variable "namespace" does not exist.', 5, $this->getSourceContext()); })()), array("\\" => "_"))), "html", null, true);
52
    }
53
54
    // line 7
55
    public function block_below_menu($context, array $blocks = array())
56
    {
57
        // line 8
58
        echo "    <div class=\"namespace-breadcrumbs\">
59
        <ol class=\"breadcrumb\">
60
            <li><span class=\"label label-default\">Namespace</span></li>
61
            ";
62
        // line 11
63
        echo $context["__internal_084c0a9b4751f3912921b1f087047d19c4c1f20b347dd6cee5246a93c0cb9eed"]->macro_breadcrumbs((isset($context["namespace"]) || array_key_exists("namespace", $context) ? $context["namespace"] : (function () { throw new Twig_Error_Runtime('Variable "namespace" does not exist.', 11, $this->getSourceContext()); })()));
64
        echo "
65
        </ol>
66
    </div>
67
";
68
    }
69
70
    // line 16
71
    public function block_page_content($context, array $blocks = array())
72
    {
73
        // line 17
74
        echo "
75
    <div class=\"page-header\">
76
        <h1>";
77
        // line 19
78
        echo (isset($context["namespace"]) || array_key_exists("namespace", $context) ? $context["namespace"] : (function () { throw new Twig_Error_Runtime('Variable "namespace" does not exist.', 19, $this->getSourceContext()); })());
79
        echo "</h1>
80
    </div>
81
82
    ";
83
        // line 22
84
        if ((isset($context["subnamespaces"]) || array_key_exists("subnamespaces", $context) ? $context["subnamespaces"] : (function () { throw new Twig_Error_Runtime('Variable "subnamespaces" does not exist.', 22, $this->getSourceContext()); })())) {
85
            // line 23
86
            echo "        <h2>Namespaces</h2>
87
        <div class=\"namespace-list\">
88
            ";
89
            // line 25
90
            $context['_parent'] = $context;
91
            $context['_seq'] = twig_ensure_traversable((isset($context["subnamespaces"]) || array_key_exists("subnamespaces", $context) ? $context["subnamespaces"] : (function () { throw new Twig_Error_Runtime('Variable "subnamespaces" does not exist.', 25, $this->getSourceContext()); })()));
92
            foreach ($context['_seq'] as $context["_key"] => $context["ns"]) {
93
                echo $context["__internal_084c0a9b4751f3912921b1f087047d19c4c1f20b347dd6cee5246a93c0cb9eed"]->macro_namespace_link($context["ns"]);
94
            }
95
            $_parent = $context['_parent'];
96
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['ns'], $context['_parent'], $context['loop']);
97
            $context = array_intersect_key($context, $_parent) + $_parent;
98
            // line 26
99
            echo "        </div>
100
    ";
101
        }
102
        // line 28
103
        echo "
104
    ";
105
        // line 29
106
        if ((isset($context["classes"]) || array_key_exists("classes", $context) ? $context["classes"] : (function () { throw new Twig_Error_Runtime('Variable "classes" does not exist.', 29, $this->getSourceContext()); })())) {
107
            // line 30
108
            echo "        <h2>Classes</h2>
109
        ";
110
            // line 31
111
            echo $context["__internal_084c0a9b4751f3912921b1f087047d19c4c1f20b347dd6cee5246a93c0cb9eed"]->macro_render_classes((isset($context["classes"]) || array_key_exists("classes", $context) ? $context["classes"] : (function () { throw new Twig_Error_Runtime('Variable "classes" does not exist.', 31, $this->getSourceContext()); })()));
112
            echo "
113
    ";
114
        }
115
        // line 33
116
        echo "
117
    ";
118
        // line 34
119
        if ((isset($context["interfaces"]) || array_key_exists("interfaces", $context) ? $context["interfaces"] : (function () { throw new Twig_Error_Runtime('Variable "interfaces" does not exist.', 34, $this->getSourceContext()); })())) {
120
            // line 35
121
            echo "        <h2>Interfaces</h2>
122
        ";
123
            // line 36
124
            echo $context["__internal_084c0a9b4751f3912921b1f087047d19c4c1f20b347dd6cee5246a93c0cb9eed"]->macro_render_classes((isset($context["interfaces"]) || array_key_exists("interfaces", $context) ? $context["interfaces"] : (function () { throw new Twig_Error_Runtime('Variable "interfaces" does not exist.', 36, $this->getSourceContext()); })()));
125
            echo "
126
    ";
127
        }
128
        // line 38
129
        echo "
130
    ";
131
        // line 39
132
        if ((isset($context["exceptions"]) || array_key_exists("exceptions", $context) ? $context["exceptions"] : (function () { throw new Twig_Error_Runtime('Variable "exceptions" does not exist.', 39, $this->getSourceContext()); })())) {
133
            // line 40
134
            echo "        <h2>Exceptions</h2>
135
        ";
136
            // line 41
137
            echo $context["__internal_084c0a9b4751f3912921b1f087047d19c4c1f20b347dd6cee5246a93c0cb9eed"]->macro_render_classes((isset($context["exceptions"]) || array_key_exists("exceptions", $context) ? $context["exceptions"] : (function () { throw new Twig_Error_Runtime('Variable "exceptions" does not exist.', 41, $this->getSourceContext()); })()));
138
            echo "
139
    ";
140
        }
141
        // line 43
142
        echo "
143
";
144
    }
145
146
    public function getTemplateName()
147
    {
148
        return "namespace.twig";
149
    }
150
151
    public function isTraitable()
152
    {
153
        return false;
154
    }
155
156
    public function getDebugInfo()
157
    {
158
        return array (  142 => 43,  137 => 41,  134 => 40,  132 => 39,  129 => 38,  124 => 36,  121 => 35,  119 => 34,  116 => 33,  111 => 31,  108 => 30,  106 => 29,  103 => 28,  99 => 26,  90 => 25,  86 => 23,  84 => 22,  78 => 19,  74 => 17,  71 => 16,  63 => 11,  58 => 8,  55 => 7,  49 => 5,  43 => 4,  35 => 3,  31 => 1,  29 => 2,  11 => 1,);
159
    }
160
161
    public function getSourceContext()
162
    {
163
        return new Twig_Source("{% extends \"layout/layout.twig\" %}
164
{% from \"macros.twig\" import breadcrumbs, render_classes, class_link, namespace_link %}
165
{% block title %}{{ namespace|raw }} | {{ parent() }}{% endblock %}
166
{% block body_class 'namespace' %}
167
{% block page_id 'namespace:' ~ (namespace|replace({'\\\\': '_'})) %}
168
169
{% block below_menu %}
170
    <div class=\"namespace-breadcrumbs\">
171
        <ol class=\"breadcrumb\">
172
            <li><span class=\"label label-default\">Namespace</span></li>
173
            {{ breadcrumbs(namespace) }}
174
        </ol>
175
    </div>
176
{% endblock %}
177
178
{% block page_content %}
179
180
    <div class=\"page-header\">
181
        <h1>{{ namespace|raw }}</h1>
182
    </div>
183
184
    {% if subnamespaces %}
185
        <h2>Namespaces</h2>
186
        <div class=\"namespace-list\">
187
            {% for ns in subnamespaces %}{{ namespace_link(ns) }}{% endfor %}
188
        </div>
189
    {% endif %}
190
191
    {% if classes %}
192
        <h2>Classes</h2>
193
        {{ render_classes(classes) }}
194
    {% endif %}
195
196
    {% if interfaces %}
197
        <h2>Interfaces</h2>
198
        {{ render_classes(interfaces) }}
199
    {% endif %}
200
201
    {% if exceptions %}
202
        <h2>Exceptions</h2>
203
        {{ render_classes(exceptions) }}
204
    {% endif %}
205
206
{% endblock %}
207
", "namespace.twig", "phar:///Users/bobby/Dropbox/Sites/OpenSource/Slackify/sami.phar/Sami/Resources/themes/default/namespace.twig");
208
    }
209
}
210