Completed
Branch master (cd0f1c)
by Michael
03:21
created

doDisplay()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
/* search.twig */
4
class __TwigTemplate_e70e62093e8f3084819c1df4e93d0e087a2a0e4bc73d6c9e00b07b6a037ff853 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", "search.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
            'js_search' => array($this, 'block_js_search'),
17
        );
18
    }
19
20
    protected function doGetParent(array $context)
21
    {
22
        return "layout/layout.twig";
23
    }
24
25
    protected function doDisplay(array $context, array $blocks = array())
26
    {
27
        // line 2
28
        $context["__internal_7d77848fe072a19ce1c194dcd815efc01316d1ff1ac5f5506bbb750580ab41bd"] = $this->loadTemplate("macros.twig", "search.twig", 2);
29
        // line 1
30
        $this->parent->display($context, array_merge($this->blocks, $blocks));
31
    }
32
33
    // line 3
34
    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...
35
    {
36
        echo "Search | ";
37
        $this->displayParentBlock("title", $context, $blocks);
38
    }
39
40
    // line 4
41
    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...
42
    {
43
        echo "search-page";
44
    }
45
46
    // line 6
47
    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...
48
    {
49
        // line 7
50
        echo "
51
    <div class=\"page-header\">
52
        <h1>Search</h1>
53
    </div>
54
55
    <p>This page allows you to search through the API documentation for
56
    specific terms. Enter your search words into the box below and click
57
    \"submit\". The search will be performed on namespaces, clases, interfaces,
58
    traits, functions, and methods.</p>
59
60
    <form class=\"form-inline\" role=\"form\" action=\"";
61
        // line 17
62
        echo twig_escape_filter($this->env, $this->env->getExtension('sami')->pathForStaticFile($context, "search.html"), "html", null, true);
63
        echo "\" method=\"GET\">
64
        <div class=\"form-group\">
65
            <label class=\"sr-only\" for=\"search\">Search</label>
66
            <input type=\"search\" class=\"form-control\" name=\"search\" id=\"search\" placeholder=\"Search\">
67
        </div>
68
        <button type=\"submit\" class=\"btn btn-default\">submit</button>
69
    </form>
70
71
    <h2>Search Results</h2>
72
73
    <div class=\"container-fluid\">
74
        <ul class=\"search-results\"></ul>
75
    </div>
76
77
    ";
78
        // line 31
79
        $this->displayBlock("js_search", $context, $blocks);
80
        echo "
81
82
";
83
    }
84
85
    // line 35
86
    public function block_js_search($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...
87
    {
88
        // line 36
89
        echo "    <script type=\"text/javascript\">
90
91
        (function() {
92
            var term = Sami.cleanSearchTerm();
93
94
            if (!term) {
95
                \$('h2').hide();
96
                return;
97
            }
98
99
            \$('#search').val(term);
100
            var container = \$('.search-results');
101
102
            // create the search index
103
            ";
104
        // line 50
105
        $this->displayBlock("search_index", $context, $blocks);
106
        echo "
107
108
            var results = Sami.search(term);
109
            var len = results.length;
110
111
            if (len == 0) {
112
                container.html('No results were found');
113
                return;
114
            }
115
116
            for (var i = 0, text_content = ''; i < len; i++) {
117
118
                var ele = results[i];
119
                var contents = '<li><h2 class=\"clearfix\">';
120
                var class_name = Sami.getSearchClass(ele.type);
121
                contents += '<a href=\"' + ele.link + '\">' + ele.name + '</a>';
122
                contents += '<div class=\"search-type type-' + ele.type + '\"><span class=\"pull-right label ' + class_name + '\">' + ele.type + '</span></div>';
123
                contents += '</h2>';
124
125
                if (ele.fromName && ele.fromLink) {
126
                    contents += '<div class=\"search-from\">from <a href=\"' + ele.fromLink + '\">' + ele.fromName + '</a></div>';
127
                }
128
129
                contents += '<div class=\"search-description\">';
130
131
                // Add description, decode entities, and strip wrapping quotes
132
                if (ele.doc) {
133
                    text_content = \$('<p>' + ele.doc + '</p>').text();
134
                    if (text_content[0] == '\"') {
135
                        text_content = text_content.substring(1);
136
                    }
137
                    if (text_content[text_content.length - 1] == '\"') {
138
                        text_content = text_content.substring(0, text_content.length - 1);
139
                    }
140
                    contents += text_content;
141
                }
142
143
                contents += '</div></li>';
144
                container.append(\$(contents));
145
            }
146
        })();
147
    </script>
148
";
149
    }
150
151
    public function getTemplateName()
152
    {
153
        return "search.twig";
154
    }
155
156
    public function isTraitable()
157
    {
158
        return false;
159
    }
160
161
    public function getDebugInfo()
162
    {
163
        return array (  105 => 50,  89 => 36,  86 => 35,  79 => 31,  62 => 17,  50 => 7,  47 => 6,  41 => 4,  34 => 3,  30 => 1,  28 => 2,  11 => 1,);
164
    }
165
}
166
/* {% 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...
167
/* {% from "macros.twig" import class_link, namespace_link, method_link, property_link %}*/
168
/* {% block title %}Search | {{ 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...
169
/* {% block body_class 'search-page' %}*/
170
/* */
171
/* {% block page_content %}*/
172
/* */
173
/*     <div class="page-header">*/
174
/*         <h1>Search</h1>*/
175
/*     </div>*/
176
/* */
177
/*     <p>This page allows you to search through the API documentation for*/
178
/*     specific terms. Enter your search words into the box below and click*/
179
/*     "submit". The search will be performed on namespaces, clases, interfaces,*/
180
/*     traits, functions, and methods.</p>*/
181
/* */
182
/*     <form class="form-inline" role="form" action="{{ path('search.html') }}" method="GET">*/
183
/*         <div class="form-group">*/
184
/*             <label class="sr-only" for="search">Search</label>*/
185
/*             <input type="search" class="form-control" name="search" id="search" placeholder="Search">*/
186
/*         </div>*/
187
/*         <button type="submit" class="btn btn-default">submit</button>*/
188
/*     </form>*/
189
/* */
190
/*     <h2>Search Results</h2>*/
191
/* */
192
/*     <div class="container-fluid">*/
193
/*         <ul class="search-results"></ul>*/
194
/*     </div>*/
195
/* */
196
/*     {{ block('js_search') }}*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
64% 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...
197
/* */
198
/* {% endblock %}*/
199
/* */
200
/* {% block js_search %}*/
201
/*     <script type="text/javascript">*/
202
/* */
203
/*         (function() {*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% 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...
204
/*             var term = Sami.cleanSearchTerm();*/
205
/* */
206
/*             if (!term) {*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% 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...
207
/*                 $('h2').hide();*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% 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...
208
/*                 return;*/
209
/*             }*/
210
/* */
211
/*             $('#search').val(term);*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
64% 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...
212
/*             var container = $('.search-results');*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
213
/* */
214
/*             // create the search index*/
215
/*             {{ block('search_index') }}*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
64% 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...
216
/* */
217
/*             var results = Sami.search(term);*/
218
/*             var len = results.length;*/
219
/* */
220
/*             if (len == 0) {*/
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...
221
/*                 container.html('No results were found');*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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...
222
/*                 return;*/
223
/*             }*/
224
/* */
225
/*             for (var i = 0, text_content = ''; i < len; i++) {*/
226
/* */
227
/*                 var ele = results[i];*/
228
/*                 var contents = '<li><h2 class="clearfix">';*/
229
/*                 var class_name = Sami.getSearchClass(ele.type);*/
230
/*                 contents += '<a href="' + ele.link + '">' + ele.name + '</a>';*/
231
/*                 contents += '<div class="search-type type-' + ele.type + '"><span class="pull-right label ' + class_name + '">' + ele.type + '</span></div>';*/
232
/*                 contents += '</h2>';*/
233
/* */
234
/*                 if (ele.fromName && ele.fromLink) {*/
235
/*                     contents += '<div class="search-from">from <a href="' + ele.fromLink + '">' + ele.fromName + '</a></div>';*/
236
/*                 }*/
237
/* */
238
/*                 contents += '<div class="search-description">';*/
239
/* */
240
/*                 // Add description, decode entities, and strip wrapping quotes*/
241
/*                 if (ele.doc) {*/
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...
242
/*                     text_content = $('<p>' + ele.doc + '</p>').text();*/
243
/*                     if (text_content[0] == '"') {*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
54% 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...
244
/*                         text_content = text_content.substring(1);*/
245
/*                     }*/
246
/*                     if (text_content[text_content.length - 1] == '"') {*/
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...
247
/*                         text_content = text_content.substring(0, text_content.length - 1);*/
248
/*                     }*/
249
/*                     contents += text_content;*/
250
/*                 }*/
251
/* */
252
/*                 contents += '</div></li>';*/
253
/*                 container.append($(contents));*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
55% 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...
254
/*             }*/
255
/*         })();*/
0 ignored issues
show
Unused Code Comprehensibility introduced by
84% 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...
256
/*     </script>*/
257
/* {% endblock %}*/
258
/* */
259