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

doDisplay()   C

Complexity

Conditions 13
Paths 3

Size

Total Lines 42
Code Lines 20

Duplication

Lines 7
Ratio 16.67 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 7
loc 42
rs 5.1234
cc 13
eloc 20
nc 3
nop 2

How to fix   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
/* opensearch.twig */
4
class __TwigTemplate_6176cc1d70865f1c372391bee7ea89c10a999e56953e3bd41cdecc0c6a3f3921 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
        $this->parent = false;
11
12
        $this->blocks = array(
13
        );
14
    }
15
16
    protected function doDisplay(array $context, array $blocks = array())
17
    {
18
        // line 1
19
        if ($this->getAttribute((isset($context["project"]) ? $context["project"] : $this->getContext($context, "project")), "config", array(0 => "base_url"), "method")) {
20
            // line 2
21
            echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
22
    <OpenSearchDescription xmlns=\"http://a9.com/-/spec/opensearch/1.1/\" xmlns:referrer=\"http://a9.com/-/opensearch/extensions/referrer/\">
23
        <ShortName>";
24
            // line 4
25
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["project"]) ? $context["project"] : $this->getContext($context, "project")), "config", array(0 => "title"), "method"), "html", null, true);
26
            echo " (";
27
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["project"]) ? $context["project"] : $this->getContext($context, "project")), "version", array()), "html", null, true);
28
            echo ")</ShortName>
29
        <Description>Searches ";
30
            // line 5
31
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["project"]) ? $context["project"] : $this->getContext($context, "project")), "config", array(0 => "title"), "method"), "html", null, true);
32
            echo " (";
33
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["project"]) ? $context["project"] : $this->getContext($context, "project")), "version", array()), "html", null, true);
34
            echo ")</Description>
35
        <Tags>";
36
            // line 6
37
            echo twig_escape_filter($this->env, $this->getAttribute((isset($context["project"]) ? $context["project"] : $this->getContext($context, "project")), "config", array(0 => "title"), "method"), "html", null, true);
38
            echo "</Tags>
39
        ";
40
            // line 7
41 View Code Duplication
            if ($this->getAttribute((isset($context["project"]) ? $context["project"] : $this->getContext($context, "project")), "config", array(0 => "favicon"), "method")) {
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...
42
                // line 8
43
                echo "<Image height=\"16\" width=\"16\" type=\"image/x-icon\">";
44
                echo twig_escape_filter($this->env, $this->getAttribute((isset($context["project"]) ? $context["project"] : $this->getContext($context, "project")), "config", array(0 => "favicon"), "method"), "html", null, true);
45
                echo "</Image>
46
        ";
47
            }
48
            // line 10
49
            echo "        <Url type=\"text/html\" method=\"GET\" template=\"";
50
            echo twig_escape_filter($this->env, (twig_replace_filter($this->getAttribute((isset($context["project"]) ? $context["project"] : $this->getContext($context, "project")), "config", array(0 => "base_url"), "method"), array("%version%" => $this->getAttribute((isset($context["project"]) ? $context["project"] : $this->getContext($context, "project")), "version", array()))) . "/index.html?q={searchTerms}&src={referrer:source?}"), "html", null, true);
51
            echo "\"/>
52
        <InputEncoding>UTF-8</InputEncoding>
53
        <AdultContent>false</AdultContent>
54
    </OpenSearchDescription>
55
";
56
        }
57
    }
58
59
    public function getTemplateName()
60
    {
61
        return "opensearch.twig";
62
    }
63
64
    public function isTraitable()
65
    {
66
        return false;
67
    }
68
69
    public function getDebugInfo()
70
    {
71
        return array (  49 => 10,  43 => 8,  41 => 7,  37 => 6,  31 => 5,  25 => 4,  21 => 2,  19 => 1,);
72
    }
73
}
74
/* {% if project.config('base_url') -%}*/
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...
75
/*     <?xml version="1.0" encoding="UTF-8"?>*/
76
/*     <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:referrer="http://a9.com/-/opensearch/extensions/referrer/">*/
77
/*         <ShortName>{{ project.config('title') }} ({{ project.version }})</ShortName>*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
41% 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...
78
/*         <Description>Searches {{ project.config('title') }} ({{ project.version }})</Description>*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
39% 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...
79
/*         <Tags>{{ project.config('title') }}</Tags>*/
80
/*         {% if project.config('favicon') -%}*/
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...
81
/*             <Image height="16" width="16" type="image/x-icon">{{ project.config('favicon') }}</Image>*/
82
/*         {% 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...
83
/*         <Url type="text/html" method="GET" template="{{ project.config('base_url')|replace({'%version%': project.version}) ~ '/index.html?q={searchTerms}&src={referrer:source?}' }}"/>*/
84
/*         <InputEncoding>UTF-8</InputEncoding>*/
85
/*         <AdultContent>false</AdultContent>*/
86
/*     </OpenSearchDescription>*/
87
/* {% 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...
88
/* */
89