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
Push — master ( c188f7...035d67 )
by Romain
05:21
created

__TwigTemplate_398f8f56f7a75190ac0c4cefac17f525cd427ead086ca80c0ac47528545c2ce2   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 13
lcom 1
cbo 3
dl 0
loc 66
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A doGetParent() 0 5 3
A doDisplay() 0 13 4
A block_body_class() 0 4 1
A getTemplateName() 0 4 1
A isTraitable() 0 4 1
A getDebugInfo() 0 4 1
A getSourceContext() 0 13 1
1
<?php
2
3
/* index.twig */
4
class __TwigTemplate_398f8f56f7a75190ac0c4cefac17f525cd427ead086ca80c0ac47528545c2ce2 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...
5
{
6
    public function __construct(Twig_Environment $env)
7
    {
8
        parent::__construct($env);
9
10
        $this->blocks = array(
11
            'body_class' => array($this, 'block_body_class'),
12
        );
13
    }
14
15
    protected function doGetParent(array $context)
16
    {
17
        // line 7
18
        return $this->loadTemplate((isset($context["extension"]) || array_key_exists("extension", $context) ? $context["extension"] : (function () { throw new Twig_Error_Runtime('Variable "extension" does not exist.', 7, $this->getSourceContext()); })()), "index.twig", 7);
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->loadTempla...})(), 'index.twig', 7); (Twig_Template|Twig_TemplateWrapper) is incompatible with the return type of the parent method Twig_Template::doGetParent of type boolean.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
19
    }
20
21
    protected function doDisplay(array $context, array $blocks = array())
22
    {
23
        // line 1
24
        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.', 1, $this->getSourceContext()); })())) {
25
            // line 2
26
            $context["extension"] = "namespaces.twig";
27
        } else {
28
            // line 4
29
            $context["extension"] = "classes.twig";
30
        }
31
        // line 7
32
        $this->getParent($context)->display($context, array_merge($this->blocks, $blocks));
33
    }
34
35
    // line 9
36
    public function block_body_class($context, array $blocks = array())
0 ignored issues
show
Unused Code introduced by
The parameter $context is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $blocks is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
    {
38
        echo "index";
39
    }
40
41
    public function getTemplateName()
42
    {
43
        return "index.twig";
44
    }
45
46
    public function isTraitable()
47
    {
48
        return false;
49
    }
50
51
    public function getDebugInfo()
52
    {
53
        return array (  36 => 9,  32 => 7,  29 => 4,  26 => 2,  24 => 1,  18 => 7,);
54
    }
55
56
    public function getSourceContext()
57
    {
58
        return new Twig_Source("{% if has_namespaces %}
59
    {% set extension = 'namespaces.twig' %}
60
{% else %}
61
    {% set extension = 'classes.twig' %}
62
{% endif %}
63
64
{% extends extension %}
65
66
{% block body_class 'index' %}
67
", "index.twig", "phar:///Users/bobby/Dropbox/Sites/OpenSource/Slackify/sami.phar/Sami/Resources/themes/default/index.twig");
68
    }
69
}
70