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_b9b3adde2bcfcaf50a5c79578957f3ba1f0ecf6cd73e728dd11e9ded2e0f778e   C

Complexity

Total Complexity 55

Size/Duplication

Total Lines 216
Duplicated Lines 1.85 %

Coupling/Cohesion

Components 2
Dependencies 4

Importance

Changes 0
Metric Value
wmc 55
lcom 2
cbo 4
dl 4
loc 216
rs 6.8
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_b9b3adde2bcfcaf50a5c79578957f3ba1f0ecf6cd73e728dd11e9ded2e0f778e 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_b9b3adde2bcfcaf50a5c79578957f3ba1f0ecf6cd73e728dd11e9ded2e0f778e, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
/* doc-index.twig */
4
class __TwigTemplate_b9b3adde2bcfcaf50a5c79578957f3ba1f0ecf6cd73e728dd11e9ded2e0f778e 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", "doc-index.twig", 1);
12
        $this->blocks = array(
13
            'title' => array($this, 'block_title'),
14
            'body_class' => array($this, 'block_body_class'),
15
            'page_content' => array($this, 'block_page_content'),
16
        );
17
    }
18
19
    protected function doGetParent(array $context)
20
    {
21
        return "layout/layout.twig";
22
    }
23
24
    protected function doDisplay(array $context, array $blocks = array())
25
    {
26
        // line 2
27
        $context["__internal_351d30495b226f3f6aab1ed2b80d7044af729b76f061877fc02bc5b20e6949bc"] = $this->loadTemplate("macros.twig", "doc-index.twig", 2);
28
        // line 1
29
        $this->parent->display($context, array_merge($this->blocks, $blocks));
30
    }
31
32
    // line 3
33
    public function block_title($context, array $blocks = array())
34
    {
35
        echo "Index | ";
36
        $this->displayParentBlock("title", $context, $blocks);
37
    }
38
39
    // line 4
40
    public function block_body_class($context, array $blocks = array())
41
    {
42
        echo "doc-index";
43
    }
44
45
    // line 6
46
    public function block_page_content($context, array $blocks = array())
47
    {
48
        // line 7
49
        echo "
50
    <div class=\"page-header\">
51
        <h1>Index</h1>
52
    </div>
53
54
    <ul class=\"pagination\">
55
        ";
56
        // line 13
57
        $context['_parent'] = $context;
58
        $context['_seq'] = twig_ensure_traversable(range("A", "Z"));
59
        foreach ($context['_seq'] as $context["_key"] => $context["letter"]) {
60
            // line 14
61
            echo "            ";
62
            if ((twig_get_attribute($this->env, $this->getSourceContext(), ($context["items"] ?? null), $context["letter"], array(), "array", true, true) && (twig_length_filter($this->env, twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["items"]) || array_key_exists("items", $context) ? $context["items"] : (function () { throw new Twig_Error_Runtime('Variable "items" does not exist.', 14, $this->getSourceContext()); })()), $context["letter"], array(), "array")) > 1))) {
63
                // line 15
64
                echo "                <li><a href=\"#letter";
65
                echo $context["letter"];
66
                echo "\">";
67
                echo $context["letter"];
68
                echo "</a></li>
69
            ";
70
            } else {
71
                // line 17
72
                echo "                <li class=\"disabled\"><a href=\"#letter";
73
                echo $context["letter"];
74
                echo "\">";
75
                echo $context["letter"];
76
                echo "</a></li>
77
            ";
78
            }
79
            // line 19
80
            echo "        ";
81
        }
82
        $_parent = $context['_parent'];
83
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['letter'], $context['_parent'], $context['loop']);
84
        $context = array_intersect_key($context, $_parent) + $_parent;
85
        // line 20
86
        echo "    </ul>
87
88
    ";
89
        // line 22
90
        $context['_parent'] = $context;
91
        $context['_seq'] = twig_ensure_traversable((isset($context["items"]) || array_key_exists("items", $context) ? $context["items"] : (function () { throw new Twig_Error_Runtime('Variable "items" does not exist.', 22, $this->getSourceContext()); })()));
92
        foreach ($context['_seq'] as $context["letter"] => $context["elements"]) {
93
            // line 23
94
            echo "<h2 id=\"letter";
95
            echo $context["letter"];
96
            echo "\">";
97
            echo $context["letter"];
98
            echo "</h2>
99
        <dl id=\"index\">";
100
            // line 25
101
            $context['_parent'] = $context;
102
            $context['_seq'] = twig_ensure_traversable($context["elements"]);
103
            foreach ($context['_seq'] as $context["_key"] => $context["element"]) {
104
                // line 26
105
                $context["type"] = twig_get_attribute($this->env, $this->getSourceContext(), $context["element"], 0, array(), "array");
106
                // line 27
107
                $context["value"] = twig_get_attribute($this->env, $this->getSourceContext(), $context["element"], 1, array(), "array");
108
                // line 28
109
                if (("class" == (isset($context["type"]) || array_key_exists("type", $context) ? $context["type"] : (function () { throw new Twig_Error_Runtime('Variable "type" does not exist.', 28, $this->getSourceContext()); })()))) {
110
                    // line 29
111
                    echo "<dt>";
112
                    echo $context["__internal_351d30495b226f3f6aab1ed2b80d7044af729b76f061877fc02bc5b20e6949bc"]->macro_class_link((isset($context["value"]) || array_key_exists("value", $context) ? $context["value"] : (function () { throw new Twig_Error_Runtime('Variable "value" does not exist.', 29, $this->getSourceContext()); })()));
113
                    if ((isset($context["has_namespaces"]) || array_key_exists("has_namespaces", $context) ? $context["has_namespaces"] : (function () { throw new Twig_Error_Runtime('Variable "has_namespaces" does not exist.', 29, $this->getSourceContext()); })())) {
114
                        echo " &mdash; <em>Class in namespace ";
115
                        echo $context["__internal_351d30495b226f3f6aab1ed2b80d7044af729b76f061877fc02bc5b20e6949bc"]->macro_namespace_link(twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["value"]) || array_key_exists("value", $context) ? $context["value"] : (function () { throw new Twig_Error_Runtime('Variable "value" does not exist.', 29, $this->getSourceContext()); })()), "namespace", array()));
116
                    }
117
                    echo "</em></dt>
118
                    <dd>";
119
                    // line 30
120
                    echo $this->env->getExtension('Sami\Renderer\TwigExtension')->parseDesc($context, twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["value"]) || array_key_exists("value", $context) ? $context["value"] : (function () { throw new Twig_Error_Runtime('Variable "value" does not exist.', 30, $this->getSourceContext()); })()), "shortdesc", array()), (isset($context["value"]) || array_key_exists("value", $context) ? $context["value"] : (function () { throw new Twig_Error_Runtime('Variable "value" does not exist.', 30, $this->getSourceContext()); })()));
121
                    echo "</dd>";
122
                } elseif (("method" ==                 // line 31
123
(isset($context["type"]) || array_key_exists("type", $context) ? $context["type"] : (function () { throw new Twig_Error_Runtime('Variable "type" does not exist.', 31, $this->getSourceContext()); })()))) {
124
                    // line 32
125
                    echo "<dt>";
126
                    echo $context["__internal_351d30495b226f3f6aab1ed2b80d7044af729b76f061877fc02bc5b20e6949bc"]->macro_method_link((isset($context["value"]) || array_key_exists("value", $context) ? $context["value"] : (function () { throw new Twig_Error_Runtime('Variable "value" does not exist.', 32, $this->getSourceContext()); })()));
127
                    echo "() &mdash; <em>Method in class ";
128
                    echo $context["__internal_351d30495b226f3f6aab1ed2b80d7044af729b76f061877fc02bc5b20e6949bc"]->macro_class_link(twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["value"]) || array_key_exists("value", $context) ? $context["value"] : (function () { throw new Twig_Error_Runtime('Variable "value" does not exist.', 32, $this->getSourceContext()); })()), "class", array()));
129
                    echo "</em></dt>
130
                    <dd>";
131
                    // line 33
132
                    echo $this->env->getExtension('Sami\Renderer\TwigExtension')->parseDesc($context, twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["value"]) || array_key_exists("value", $context) ? $context["value"] : (function () { throw new Twig_Error_Runtime('Variable "value" does not exist.', 33, $this->getSourceContext()); })()), "shortdesc", array()), twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["value"]) || array_key_exists("value", $context) ? $context["value"] : (function () { throw new Twig_Error_Runtime('Variable "value" does not exist.', 33, $this->getSourceContext()); })()), "class", array()));
133
                    echo "</dd>";
134
                } elseif (("property" ==                 // line 34
135
(isset($context["type"]) || array_key_exists("type", $context) ? $context["type"] : (function () { throw new Twig_Error_Runtime('Variable "type" does not exist.', 34, $this->getSourceContext()); })()))) {
136
                    // line 35
137
                    echo "<dt>\$";
138
                    echo $context["__internal_351d30495b226f3f6aab1ed2b80d7044af729b76f061877fc02bc5b20e6949bc"]->macro_property_link((isset($context["value"]) || array_key_exists("value", $context) ? $context["value"] : (function () { throw new Twig_Error_Runtime('Variable "value" does not exist.', 35, $this->getSourceContext()); })()));
139
                    echo " &mdash; <em>Property in class ";
140
                    echo $context["__internal_351d30495b226f3f6aab1ed2b80d7044af729b76f061877fc02bc5b20e6949bc"]->macro_class_link(twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["value"]) || array_key_exists("value", $context) ? $context["value"] : (function () { throw new Twig_Error_Runtime('Variable "value" does not exist.', 35, $this->getSourceContext()); })()), "class", array()));
141
                    echo "</em></dt>
142
                    <dd>";
143
                    // line 36
144
                    echo $this->env->getExtension('Sami\Renderer\TwigExtension')->parseDesc($context, twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["value"]) || array_key_exists("value", $context) ? $context["value"] : (function () { throw new Twig_Error_Runtime('Variable "value" does not exist.', 36, $this->getSourceContext()); })()), "shortdesc", array()), twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["value"]) || array_key_exists("value", $context) ? $context["value"] : (function () { throw new Twig_Error_Runtime('Variable "value" does not exist.', 36, $this->getSourceContext()); })()), "class", array()));
145
                    echo "</dd>";
146
                }
147
            }
148
            $_parent = $context['_parent'];
149
            unset($context['_seq'], $context['_iterated'], $context['_key'], $context['element'], $context['_parent'], $context['loop']);
150
            $context = array_intersect_key($context, $_parent) + $_parent;
151
            // line 39
152
            echo "        </dl>";
153
        }
154
        $_parent = $context['_parent'];
155
        unset($context['_seq'], $context['_iterated'], $context['letter'], $context['elements'], $context['_parent'], $context['loop']);
156
        $context = array_intersect_key($context, $_parent) + $_parent;
157
    }
158
159
    public function getTemplateName()
160
    {
161
        return "doc-index.twig";
162
    }
163
164
    public function isTraitable()
165
    {
166
        return false;
167
    }
168
169
    public function getDebugInfo()
170
    {
171
        return array (  152 => 39,  144 => 36,  137 => 35,  135 => 34,  132 => 33,  125 => 32,  123 => 31,  120 => 30,  111 => 29,  109 => 28,  107 => 27,  105 => 26,  101 => 25,  94 => 23,  90 => 22,  86 => 20,  80 => 19,  72 => 17,  64 => 15,  61 => 14,  57 => 13,  49 => 7,  46 => 6,  40 => 4,  33 => 3,  29 => 1,  27 => 2,  11 => 1,);
172
    }
173
174
    public function getSourceContext()
175
    {
176
        return new Twig_Source("{% extends \"layout/layout.twig\" %}
177
{% from \"macros.twig\" import class_link, namespace_link, method_link, property_link %}
178
{% block title %}Index | {{ parent() }}{% endblock %}
179
{% block body_class 'doc-index' %}
180
181
{% block page_content %}
182
183
    <div class=\"page-header\">
184
        <h1>Index</h1>
185
    </div>
186
187
    <ul class=\"pagination\">
188
        {% for letter in 'A'..'Z' %}
189
            {% if items[letter] is defined and items[letter]|length > 1 %}
190
                <li><a href=\"#letter{{ letter|raw }}\">{{ letter|raw }}</a></li>
191
            {% else %}
192
                <li class=\"disabled\"><a href=\"#letter{{ letter|raw }}\">{{ letter|raw }}</a></li>
193
            {% endif %}
194
        {% endfor %}
195
    </ul>
196
197
    {% for letter, elements in items -%}
198
        <h2 id=\"letter{{ letter|raw }}\">{{ letter|raw }}</h2>
199
        <dl id=\"index\">
200
            {%- for element in elements %}
201
                {%- set type = element[0] %}
202
                {%- set value = element[1] %}
203
                {%- if 'class' == type -%}
204
                    <dt>{{ class_link(value) }}{% if has_namespaces %} &mdash; <em>Class in namespace {{ namespace_link(value.namespace) }}{% endif %}</em></dt>
205
                    <dd>{{ value.shortdesc|desc(value) }}</dd>
206
                {%- elseif 'method' == type -%}
207
                    <dt>{{ method_link(value) }}() &mdash; <em>Method in class {{ class_link(value.class) }}</em></dt>
208
                    <dd>{{ value.shortdesc|desc(value.class) }}</dd>
209
                {%- elseif 'property' == type -%}
210
                    <dt>\${{ property_link(value) }} &mdash; <em>Property in class {{ class_link(value.class) }}</em></dt>
211
                    <dd>{{ value.shortdesc|desc(value.class) }}</dd>
212
                {%- endif %}
213
            {%- endfor %}
214
        </dl>
215
    {%- endfor %}
216
{% endblock %}
217
", "doc-index.twig", "phar:///Users/bobby/Dropbox/Sites/OpenSource/Slackify/sami.phar/Sami/Resources/themes/default/doc-index.twig");
218
    }
219
}
220