Passed
Push — master ( 535460...57bd4b )
by Thierry
02:39
created

App::getJs()   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 0
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 the request callback manager
55
     *
56
     * @return \Jaxon\Request\Handler\Callback
57
     */
58
    public function callback()
59
    {
60
        return jaxon()->callback();
61
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
62
63
    /**
64
     * Determine if a call is a Jaxon request.
65
     *
66
     * @return boolean
67
     */
68
    public function canProcessRequest()
69
    {
70
        return jaxon()->canProcessRequest();
71
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
72
73
    /**
74
     * Get the HTTP response
75
     *
76
     * @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...
77
     *
78
     * @return mixed
79
     */
80
    abstract public function httpResponse($code = '200');
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
81
82
    /**
83
     * Process an incoming Jaxon request, and return the response.
84
     *
85
     * @return mixed
86
     */
87
    abstract public function processRequest();
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
88
89
    /**
90
     * Get the HTML tags to include Jaxon CSS code and files into the page.
91
     *
92
     * @return string  the javascript code
93
     */
94
    public function css()
95
    {
96
        return jaxon()->getCss();
97
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
98
99
    /**
100
     * Get the HTML tags to include Jaxon CSS code and files into the page.
101
     *
102
     * @return string  the javascript code
103
     */
104
    public function getCss()
105
    {
106
        return jaxon()->getCss();
107
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
108
109
    /**
110
     * Get the HTML tags to include Jaxon javascript files into the page.
111
     *
112
     * @return string  the javascript code
113
     */
114
    public function js()
115
    {
116
        return jaxon()->getJs();
117
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
118
119
    /**
120
     * Get the HTML tags to include Jaxon javascript files into the page.
121
     *
122
     * @return string  the javascript code
123
     */
124
    public function getJs()
125
    {
126
        return jaxon()->getJs();
127
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
128
129
    /**
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...
130
     * Get the javascript code to be sent to the browser.
131
     *
132
     * @return string  the javascript code
133
     */
134
    public function script($bIncludeJs = false, $bIncludeCss = false)
135
    {
136
        return jaxon()->getScript($bIncludeJs, $bIncludeCss);
137
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
138
139
    /**
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...
140
     * Get the javascript code to be sent to the browser.
141
     *
142
     * @return string  the javascript code
143
     */
144
    public function getScript($bIncludeJs = false, $bIncludeCss = false)
145
    {
146
        return jaxon()->getScript($bIncludeJs, $bIncludeCss);
147
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
148
149
    /**
150
     * Get the view renderer
151
     *
152
     * @return \Jaxon\Utils\View\Renderer
153
     */
154
    public function view()
155
    {
156
        return jaxon()->view();
157
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
158
159
    /**
160
     * Get the session manager
161
     *
162
     * @return \Jaxon\Contracts\Session
163
     */
164
    public function session()
165
    {
166
        return jaxon()->session();
167
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
168
169
    /**
170
     * Get the logger
171
     *
172
     * @return LoggerInterface
173
     */
174
    public function logger()
175
    {
176
        return jaxon()->logger();
177
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
178
179
    /**
180
     * Sets a logger.
181
     *
182
     * @param LoggerInterface $logger
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
183
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
184
    public function setLogger(LoggerInterface $logger)
0 ignored issues
show
Unused Code introduced by
The parameter $logger 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...
185
    {
186
        jaxon()->setLogger();
0 ignored issues
show
Bug introduced by
The call to setLogger() misses a required argument $logger.

This check looks for function calls that miss required arguments.

Loading history...
187
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
188
}
189