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

__TwigTemplate_c27e8ed7892b7ecc2047151655e75ee5edd89d7c8d0738b9d02d3aca1434616b   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 101
Duplicated Lines 17.82 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 12
c 1
b 0
f 1
lcom 0
cbo 0
dl 18
loc 101
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A doGetParent() 0 4 1
A doDisplay() 0 7 1
A block_title() 0 5 1
A block_body_class() 0 4 1
B block_page_content() 18 43 4
A getTemplateName() 0 4 1
A isTraitable() 0 4 1
A getDebugInfo() 0 4 1

How to fix   Duplicated Code   

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:

1
<?php
2
3
/* traits.twig */
4
class __TwigTemplate_c27e8ed7892b7ecc2047151655e75ee5edd89d7c8d0738b9d02d3aca1434616b 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", "traits.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_76faad54a4455c81f61cdc23c30804c7140f9aff264325797b153f5d8c55d1c6"] = $this->loadTemplate("macros.twig", "traits.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 "Traits | ";
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 "traits";
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 "    <div class=\"page-header\">
50
        <h1>Traits</h1>
51
    </div>
52
53
    <div class=\"container-fluid underlined\">
54
        ";
55
        // line 12
56
        $context['_parent'] = $context;
57
        $context['_seq'] = twig_ensure_traversable((isset($context["classes"]) ? $context["classes"] : $this->getContext($context, "classes")));
58
        foreach ($context['_seq'] as $context["_key"] => $context["class"]) {
59
            // line 13
60
            echo "            ";
61 View Code Duplication
            if ($this->getAttribute($context["class"], "trait", array())) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
62
                // line 14
63
                echo "                <div class=\"row\">
64
                    <div class=\"col-md-6\">
65
                        ";
66
                // line 16
67
                echo $context["__internal_76faad54a4455c81f61cdc23c30804c7140f9aff264325797b153f5d8c55d1c6"]->getclass_link($context["class"], true);
68
                echo "
69
                    </div>
70
                    <div class=\"col-md-6\">
71
                        ";
72
                // line 19
73
                echo $this->env->getExtension('sami')->parseDesc($context, $this->getAttribute($context["class"], "shortdesc", array()), $context["class"]);
74
                echo "
75
                    </div>
76
                </div>
77
            ";
78
            }
79
            // line 23
80
            echo "        ";
81
        }
82
        $_parent = $context['_parent'];
83
        unset($context['_seq'], $context['_iterated'], $context['_key'], $context['class'], $context['_parent'], $context['loop']);
84
        $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...
85
        // line 24
86
        echo "    </div>
87
";
88
    }
89
90
    public function getTemplateName()
91
    {
92
        return "traits.twig";
93
    }
94
95
    public function isTraitable()
96
    {
97
        return false;
98
    }
99
100
    public function getDebugInfo()
101
    {
102
        return array (  86 => 24,  80 => 23,  73 => 19,  67 => 16,  63 => 14,  60 => 13,  56 => 12,  49 => 7,  46 => 6,  40 => 4,  33 => 3,  29 => 1,  27 => 2,  11 => 1,);
103
    }
104
}
105
/* {% 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...
106
/* {% from "macros.twig" import class_link %}*/
107
/* {% block title %}Traits | {{ 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...
108
/* {% block body_class 'traits' %}*/
109
/* */
110
/* {% block page_content %}*/
111
/*     <div class="page-header">*/
112
/*         <h1>Traits</h1>*/
113
/*     </div>*/
114
/* */
115
/*     <div class="container-fluid underlined">*/
116
/*         {% for class in classes %}*/
117
/*             {% if class.trait %}*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
42% 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...
118
/*                 <div class="row">*/
119
/*                     <div class="col-md-6">*/
120
/*                         {{ class_link(class, true) }}*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% 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...
121
/*                     </div>*/
122
/*                     <div class="col-md-6">*/
123
/*                         {{ class.shortdesc|desc(class) }}*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% 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...
124
/*                     </div>*/
125
/*                 </div>*/
126
/*             {% 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...
127
/*         {% 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...
128
/*     </div>*/
129
/* {% endblock %}*/
130
/* */
131