Passed
Push — master ( 95f016...f67a13 )
by Thierry
07:34
created

Callback::getInvalidCallbacks()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * Callbacks.php - Jaxon request callbacks
5
 *
6
 * @package jaxon-core
0 ignored issues
show
Coding Style introduced by
Package name "jaxon-core" is not valid; consider "Jaxoncore" instead
Loading history...
7
 * @author Thierry Feuzeu <[email protected]>
8
 * @copyright 2017 Thierry Feuzeu <[email protected]>
9
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
10
 * @link https://github.com/jaxon-php/jaxon-core
11
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
12
13
namespace Jaxon\Request\Handler;
14
15
class Callback
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class Callback
Loading history...
16
{
17
    /**
18
     * The callbacks to run after booting the library
19
     *
20
     * @var callable[]
21
     */
22
    protected $xBootCallbacks = [];
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line(s) before first member var; 0 found
Loading history...
23
24
    /**
25
     * The callbacks to run before processing the request
26
     *
27
     * @var callable[]
28
     */
29
    protected $xBeforeCallbacks = [];
30
31
    /**
32
     * The callbacks to run afteer processing the request
33
     *
34
     * @var callable[]
35
     */
36
    protected $xAfterCallbacks = [];
37
38
    /**
39
     * The callbacks to run in case of invalid request
40
     *
41
     * @var callable[]
42
     */
43
    protected $xInvalidCallbacks = [];
44
45
    /**
46
     * The callbacks to run in case of error
47
     *
48
     * @var callable[]
49
     */
50
    protected $xErrorCallbacks = [];
51
52
    /**
53
     * The callbacks to run when a class is instanced
54
     *
55
     * @var callable[]
56
     */
57
    protected $xInitCallbacks = [];
58
59
    /**
60
     * Get the library booting callbacks.
61
     *
62
     * @return callable[]
63
     */
64
    public function getBootCallbacks()
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
65
    {
66
        return $this->xBootCallbacks;
67
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
68
69
    /**
70
     * Get the pre-request processing callbacks.
71
     *
72
     * @return callable[]
73
     */
74
    public function getBeforeCallbacks()
75
    {
76
        return $this->xBeforeCallbacks;
77
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
78
79
    /**
80
     * Get the post-request processing callbacks.
81
     *
82
     * @return callable[]
83
     */
84
    public function getAfterCallbacks()
85
    {
86
        return $this->xAfterCallbacks;
87
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
88
89
    /**
90
     * Get the invalid request callbacks.
91
     *
92
     * @return callable[]
93
     */
94
    public function getInvalidCallbacks()
95
    {
96
        return $this->xInvalidCallbacks;
97
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
98
99
    /**
100
     * Get the processing error callbacks.
101
     *
102
     * @return callable[]
103
     */
104
    public function getErrorCallbacks()
105
    {
106
        return $this->xErrorCallbacks;
107
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
108
109
    /**
110
     * Get the class initialisation callbacks.
111
     *
112
     * @return callable[]
113
     */
114
    public function getInitCallbacks()
115
    {
116
        return $this->xInitCallbacks;
117
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
118
119
    /**
120
     * Add a library booting callback.
121
     *
122
     * @param callable  $xCallable               The callback function
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 15 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
123
     *
124
     * @return Callback
125
     */
126
    public function boot($xCallable)
127
    {
128
        $this->xBootCallbacks[] = $xCallable;
129
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Jaxon\Request\Handler\Callback which is incompatible with the documented return type callable.
Loading history...
130
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
131
132
    /**
133
     * Add a pre-request processing callback.
134
     *
135
     * @param callable  $xCallable               The callback function
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 15 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
136
     *
137
     * @return Callback
138
     */
139
    public function before($xCallable)
140
    {
141
        $this->xBeforeCallbacks[] = $xCallable;
142
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Jaxon\Request\Handler\Callback which is incompatible with the documented return type callable.
Loading history...
143
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
144
145
    /**
146
     * Add a post-request processing callback.
147
     *
148
     * @param callable  $xCallable               The callback function
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 15 found
Loading history...
149
     *
150
     * @return Callback
151
     */
152
    public function after($xCallable)
153
    {
154
        $this->xAfterCallbacks[] = $xCallable;
155
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Jaxon\Request\Handler\Callback which is incompatible with the documented return type callable.
Loading history...
156
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
157
158
    /**
159
     * Add a invalid request callback.
160
     *
161
     * @param callable  $xCallable               The callback function
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 15 found
Loading history...
162
     *
163
     * @return Callback
164
     */
165
    public function invalid($xCallable)
166
    {
167
        $this->xInvalidCallbacks[] = $xCallable;
168
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Jaxon\Request\Handler\Callback which is incompatible with the documented return type callable.
Loading history...
169
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
170
171
    /**
172
     * Add a processing error callback.
173
     *
174
     * @param callable  $xCallable               The callback function
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 15 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
175
     *
176
     * @return Callback
177
     */
178
    public function error($xCallable)
179
    {
180
        $this->xErrorCallbacks[] = $xCallable;
181
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Jaxon\Request\Handler\Callback which is incompatible with the documented return type callable.
Loading history...
182
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
183
184
    /**
185
     * Add a class initialisation callback.
186
     *
187
     * @param callable  $xCallable               The callback function
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 15 found
Loading history...
188
     *
189
     * @return Callback
190
     */
191
    public function init($xCallable)
192
    {
193
        $this->xInitCallbacks[] = $xCallable;
194
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Jaxon\Request\Handler\Callback which is incompatible with the documented return type callable.
Loading history...
195
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
196
}
197