Passed
Push — master ( 1a06f6...56a418 )
by Thierry
02:34
created

App::getScript()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace Jaxon\Features;
4
5
use Psr\Log\LoggerInterface;
6
7
trait App
0 ignored issues
show
Coding Style introduced by
Missing doc comment for trait App
Loading history...
8
{
9
    /**
10
     * Get the Jaxon application bootstrapper.
11
     *
12
     * @return \Jaxon\App\Bootstrap
13
     */
14
    protected function bootstrap()
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 0 found
Loading history...
15
    {
16
        return jaxon()->di()->getBootstrap();
17
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
18
19
    /**
20
     * Get the Jaxon response.
21
     *
22
     * @return \Jaxon\Response\Response
23
     */
24
    public function ajaxResponse()
25
    {
26
        return jaxon()->getResponse();
27
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
28
29
    /**
30
     * Get an instance of a registered class
31
     *
32
     * @param string        $sClassName         The class name
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 8 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 9 found
Loading history...
33
     *
34
     * @return mixed
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use object|null.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
35
     */
36
    public function instance($sClassName)
37
    {
38
        return jaxon()->instance($sClassName);
39
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
40
41
    /**
42
     * Get a request to a registered class
43
     *
44
     * @param string        $sClassName         The class name
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 8 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 9 found
Loading history...
45
     *
46
     * @return \Jaxon\Request\Factory\CallableClass\Request
47
     */
48
    public function request($sClassName)
49
    {
50
        return jaxon()->request($sClassName);
51
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
52
53
    /**
54
     * Get a package instance
55
     *
56
     * @param string        $sClassName           The package class name
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 8 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 11 found
Loading history...
57
     *
58
     * @return \Jaxon\Plugin\Package
59
     */
60
    public function package($sClassName)
61
    {
62
        return jaxon()->package($sClassName);
63
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
64
65
    /**
66
     * Get the request callback manager
67
     *
68
     * @return \Jaxon\Request\Handler\Callback
69
     */
70
    public function callback()
71
    {
72
        return jaxon()->callback();
73
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
74
75
    /**
76
     * Determine if a call is a Jaxon request.
77
     *
78
     * @return boolean
79
     */
80
    public function canProcessRequest()
81
    {
82
        return jaxon()->canProcessRequest();
83
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
84
85
    /**
86
     * Get the HTTP response
87
     *
88
     * @param string    $code       The HTTP response code
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 4 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 7 found
Loading history...
89
     *
90
     * @return mixed
91
     */
92
    abstract public function httpResponse($code = '200');
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
93
94
    /**
95
     * Process an incoming Jaxon request, and return the response.
96
     *
97
     * @return mixed
98
     */
99
    abstract public function processRequest();
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
100
101
    /**
102
     * Get the HTML tags to include Jaxon CSS code and files into the page.
103
     *
104
     * @return string  the javascript code
105
     */
106
    public function css()
107
    {
108
        return jaxon()->getCss();
109
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
110
111
    /**
112
     * Get the HTML tags to include Jaxon CSS code and files into the page.
113
     *
114
     * @return string  the javascript code
115
     */
116
    public function getCss()
117
    {
118
        return jaxon()->getCss();
119
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
120
121
    /**
122
     * Get the HTML tags to include Jaxon javascript files into the page.
123
     *
124
     * @return string  the javascript code
125
     */
126
    public function js()
127
    {
128
        return jaxon()->getJs();
129
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
130
131
    /**
132
     * Get the HTML tags to include Jaxon javascript files into the page.
133
     *
134
     * @return string  the javascript code
135
     */
136
    public function getJs()
137
    {
138
        return jaxon()->getJs();
139
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
140
141
    /**
0 ignored issues
show
Coding Style introduced by
Parameter $bIncludeJs should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $bIncludeCss should have a doc-comment as per coding-style.
Loading history...
142
     * Get the javascript code to be sent to the browser.
143
     *
144
     * @return string  the javascript code
145
     */
146
    public function script($bIncludeJs = false, $bIncludeCss = false)
147
    {
148
        return jaxon()->getScript($bIncludeJs, $bIncludeCss);
149
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
150
151
    /**
0 ignored issues
show
Coding Style introduced by
Parameter $bIncludeJs should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $bIncludeCss should have a doc-comment as per coding-style.
Loading history...
152
     * Get the javascript code to be sent to the browser.
153
     *
154
     * @return string  the javascript code
155
     */
156
    public function getScript($bIncludeJs = false, $bIncludeCss = false)
157
    {
158
        return jaxon()->getScript($bIncludeJs, $bIncludeCss);
159
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
160
161
    /**
162
     * Get the view renderer
163
     *
164
     * @return \Jaxon\Utils\View\Renderer
165
     */
166
    public function view()
167
    {
168
        return jaxon()->view();
169
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
170
171
    /**
172
     * Get the session manager
173
     *
174
     * @return \Jaxon\Contracts\Session
175
     */
176
    public function session()
177
    {
178
        return jaxon()->session();
179
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
180
181
    /**
182
     * Get the logger
183
     *
184
     * @return LoggerInterface
185
     */
186
    public function logger()
187
    {
188
        return jaxon()->logger();
189
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
190
191
    /**
192
     * Sets a logger.
193
     *
194
     * @param LoggerInterface $logger
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
195
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
196
    public function setLogger(LoggerInterface $logger)
197
    {
198
        jaxon()->setLogger($logger);
199
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
200
}
201