Completed
Push — master ( 353d0b...cd0f1c )
by Michael
03:14
created

block_page_content()   D

Complexity

Conditions 29
Paths 21

Size

Total Lines 112
Code Lines 70

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 112
rs 4.4524
cc 29
eloc 70
nc 21
nop 2

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
/* doc-index.twig */
4
class __TwigTemplate_c5495a2d4e5c1d27134d56aff480f50b6d1c9d5a826b8bc536fe7dbee9631267 extends Twig_Template
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
Coding Style introduced by
This class is not in CamelCase format.

Classes in PHP are usually named in CamelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.

Thus the name database provider becomes DatabaseProvider.

Loading history...
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_31b6f5ef213cef65beaa17c48a7aece0e09df5bb8bd8a41d0aecf511f824fc11"] = $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())
0 ignored issues
show
Coding Style introduced by
This method is not in camel caps format.

This check looks for method names that are not written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection seeker becomes databaseConnectionSeeker.

Loading history...
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())
0 ignored issues
show
Coding Style introduced by
This method is not in camel caps format.

This check looks for method names that are not written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection seeker becomes databaseConnectionSeeker.

Loading history...
41
    {
42
        echo "doc-index";
43
    }
44
45
    // line 6
46
    public function block_page_content($context, array $blocks = array())
0 ignored issues
show
Coding Style introduced by
This method is not in camel caps format.

This check looks for method names that are not written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection seeker becomes databaseConnectionSeeker.

Loading history...
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 (($this->getAttribute((isset($context["items"]) ? $context["items"] : null), $context["letter"], array(), "array", true, true) && (twig_length_filter($this->env, $this->getAttribute((isset($context["items"]) ? $context["items"] : $this->getContext($context, "items")), $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"]) ? $context["items"] : $this->getContext($context, "items")));
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"] = $this->getAttribute($context["element"], 0, array(), "array");
106
                // line 27
107
                $context["value"] = $this->getAttribute($context["element"], 1, array(), "array");
108
                // line 28
109
                if (("class" == (isset($context["type"]) ? $context["type"] : $this->getContext($context, "type")))) {
110
                    // line 29
111
                    echo "<dt>";
112
                    echo $context["__internal_31b6f5ef213cef65beaa17c48a7aece0e09df5bb8bd8a41d0aecf511f824fc11"]->getclass_link((isset($context["value"]) ? $context["value"] : $this->getContext($context, "value")));
113
                    if ((isset($context["has_namespaces"]) ? $context["has_namespaces"] : $this->getContext($context, "has_namespaces"))) {
114
                        echo " &mdash; <em>Class in namespace ";
115
                        echo $context["__internal_31b6f5ef213cef65beaa17c48a7aece0e09df5bb8bd8a41d0aecf511f824fc11"]->getnamespace_link($this->getAttribute((isset($context["value"]) ? $context["value"] : $this->getContext($context, "value")), "namespace", array()));
116
                    }
117
                    echo "</em></dt>
118
                    <dd>";
119
                    // line 30
120
                    echo $this->env->getExtension('sami')->parseDesc($context, $this->getAttribute((isset($context["value"]) ? $context["value"] : $this->getContext($context, "value")), "shortdesc", array()), (isset($context["value"]) ? $context["value"] : $this->getContext($context, "value")));
121
                    echo "</dd>";
122
                } elseif (("method" ==                 // line 31
123
(isset($context["type"]) ? $context["type"] : $this->getContext($context, "type")))) {
124
                    // line 32
125
                    echo "<dt>";
126
                    echo $context["__internal_31b6f5ef213cef65beaa17c48a7aece0e09df5bb8bd8a41d0aecf511f824fc11"]->getmethod_link((isset($context["value"]) ? $context["value"] : $this->getContext($context, "value")));
127
                    echo "() &mdash; <em>Method in class ";
128
                    echo $context["__internal_31b6f5ef213cef65beaa17c48a7aece0e09df5bb8bd8a41d0aecf511f824fc11"]->getclass_link($this->getAttribute((isset($context["value"]) ? $context["value"] : $this->getContext($context, "value")), "class", array()));
129
                    echo "</em></dt>
130
                    <dd>";
131
                    // line 33
132
                    echo $this->env->getExtension('sami')->parseDesc($context, $this->getAttribute((isset($context["value"]) ? $context["value"] : $this->getContext($context, "value")), "shortdesc", array()), $this->getAttribute((isset($context["value"]) ? $context["value"] : $this->getContext($context, "value")), "class", array()));
133
                    echo "</dd>";
134
                } elseif (("property" ==                 // line 34
135
(isset($context["type"]) ? $context["type"] : $this->getContext($context, "type")))) {
136
                    // line 35
137
                    echo "<dt>\$";
138
                    echo $context["__internal_31b6f5ef213cef65beaa17c48a7aece0e09df5bb8bd8a41d0aecf511f824fc11"]->getproperty_link((isset($context["value"]) ? $context["value"] : $this->getContext($context, "value")));
139
                    echo " &mdash; <em>Property in class ";
140
                    echo $context["__internal_31b6f5ef213cef65beaa17c48a7aece0e09df5bb8bd8a41d0aecf511f824fc11"]->getclass_link($this->getAttribute((isset($context["value"]) ? $context["value"] : $this->getContext($context, "value")), "class", array()));
141
                    echo "</em></dt>
142
                    <dd>";
143
                    // line 36
144
                    echo $this->env->getExtension('sami')->parseDesc($context, $this->getAttribute((isset($context["value"]) ? $context["value"] : $this->getContext($context, "value")), "shortdesc", array()), $this->getAttribute((isset($context["value"]) ? $context["value"] : $this->getContext($context, "value")), "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;
0 ignored issues
show
Unused Code introduced by
$context is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
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
/* {% extends "layout/layout.twig" %}*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
40% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
175
/* {% from "macros.twig" import class_link, namespace_link, method_link, property_link %}*/
176
/* {% block title %}Index | {{ parent() }}{% endblock %}*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
40% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
177
/* {% block body_class 'doc-index' %}*/
178
/* */
179
/* {% block page_content %}*/
180
/* */
181
/*     <div class="page-header">*/
182
/*         <h1>Index</h1>*/
183
/*     </div>*/
184
/* */
185
/*     <ul class="pagination">*/
186
/*         {% for letter in 'A'..'Z' %}*/
187
/*             {% if items[letter] is defined and items[letter]|length > 1 %}*/
188
/*                 <li><a href="#letter{{ letter|raw }}">{{ letter|raw }}</a></li>*/
189
/*             {% else %}*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
38% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
190
/*                 <li class="disabled"><a href="#letter{{ letter|raw }}">{{ letter|raw }}</a></li>*/
191
/*             {% endif %}*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
38% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
192
/*         {% endfor %}*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
38% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
193
/*     </ul>*/
194
/* */
195
/*     {% for letter, elements in items -%}*/
196
/*         <h2 id="letter{{ letter|raw }}">{{ letter|raw }}</h2>*/
197
/*         <dl id="index">*/
198
/*             {%- for element in elements %}*/
199
/*                 {%- set type = element[0] %}*/
200
/*                 {%- set value = element[1] %}*/
201
/*                 {%- if 'class' == type -%}*/
202
/*                     <dt>{{ class_link(value) }}{% if has_namespaces %} &mdash; <em>Class in namespace {{ namespace_link(value.namespace) }}{% endif %}</em></dt>*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
203
/*                     <dd>{{ value.shortdesc|desc(value) }}</dd>*/
204
/*                 {%- elseif 'method' == type -%}*/
205
/*                     <dt>{{ method_link(value) }}() &mdash; <em>Method in class {{ class_link(value.class) }}</em></dt>*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
36% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
206
/*                     <dd>{{ value.shortdesc|desc(value.class) }}</dd>*/
207
/*                 {%- elseif 'property' == type -%}*/
208
/*                     <dt>${{ property_link(value) }} &mdash; <em>Property in class {{ class_link(value.class) }}</em></dt>*/
209
/*                     <dd>{{ value.shortdesc|desc(value.class) }}</dd>*/
210
/*                 {%- endif %}*/
211
/*             {%- endfor %}*/
212
/*         </dl>*/
213
/*     {%- endfor %}*/
214
/* {% endblock %}*/
215
/* */
216