Route::setHandler()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Resilient;
4
5
use \Resilient\Traits\Bindable;
6
7
/**
8
 * Route class
9
 *
10
 * @method callable run(array $args)
11
*/
12
class Route
13
{
14
    use Bindable;
15
    
16
    /**
17
     * method
18
     *
19
     * @var mixed
20
     * @access protected
21
     */
22
    protected $method;
23
    
24
    /**
25
     * pattern
26
     *
27
     * @var mixed
28
     * @access protected
29
     */
30
    protected $pattern;
31
    
32
    /**
33
     * handler
34
     *
35
     * @var mixed
36
     * @access protected
37
     */
38
    protected $handler;
39
    
40
    /**
41
     * group
42
     *
43
     * @var mixed
44
     * @access protected
45
     */
46
    protected $group;
47
    
48
    /**
49
     * identifier
50
     *
51
     * @var mixed
52
     * @access protected
53
     */
54
    protected $identifier;
55
56
    /**
57
     * args
58
     *
59
     * @var mixed
60
     * @access protected
61
     */
62
    protected $args;
63
64
    /**
65
     * __construct function.
66
     *
67
     * @access public
68
     * @param string $method
69
     * @param string $pattern
70
     * @param mixed $handler
71
     * @param string $group (default: '')
72
     * @param string $identifier (default: '')
73
     */
74
    public function __construct(string $method, string $pattern, $handler, $group = '', $identifier = '')
75
    {
76
        $this->method = $method;
77
        $this->pattern = $pattern;
78
        $this->handler = $handler;
79
        $this->group = $group;
80
        $this->identifier = $identifier;
81
    }
82
83
    /**
84
     * getMethod function.
85
     *
86
     * @access public
87
     * @return string
88
     */
89
    public function getMethod()
90
    {
91
        return $this->method;
92
    }
93
94
    /**
95
     * setMethod function.
96
     *
97
     * @access public
98
     * @param string $method
99
     * @return $this
100
     */
101
    public function setMethod(string $method)
102
    {
103
        $this->method = $method;
104
        return $this;
105
    }
106
107
    /**
108
     * getPattern function.
109
     *
110
     * @access public
111
     * @return string
112
     */
113
    public function getPattern()
114
    {
115
        return $this->pattern;
116
    }
117
118
    /**
119
     * setPattern function.
120
     *
121
     * @access public
122
     * @param string $pattern
123
     * @return $this
124
     */
125
    public function setPattern(string $pattern)
126
    {
127
        $this->pattern = $pattern;
128
        return $this;
129
    }
130
131
    /**
132
     * getHandler function.
133
     *
134
     * @access public
135
     * @return callable|string
136
     */
137
    public function getHandler()
138
    {
139
        return $this->handler;
140
    }
141
142
143
    /**
144
     * setHandler function.
145
     *
146
     * @access public
147
     * @param string $handler
148
     * @return $this
149
     */
150
    public function setHandler(string $handler)
151
    {
152
        $this->handler = $handler;
153
154
        return $this;
155
    }
156
157
    /**
158
     * getGroup function.
159
     *
160
     * @access public
161
     * @return array
162
     */
163
    public function getGroup()
164
    {
165
        return $this->group;
166
    }
167
168
    /**
169
     * setGroup function.
170
     *
171
     * @access public
172
     * @param string $group
173
     * @return $this
174
     */
175
    public function setGroup(string $group)
176
    {
177
        $this->group = $group;
178
179
        return $this;
180
    }
181
182
    /**
183
     * getIdentifier function.
184
     *
185
     * @access public
186
     * @return string
187
     */
188
    public function getIdentifier()
189
    {
190
        return $this->identifier;
191
    }
192
193
    /**
194
     * setIdentifier function.
195
     *
196
     * @access public
197
     * @param string $identifier
198
     * @return $this
199
     */
200
    public function setIdentifier(string $identifier)
201
    {
202
        $this->identifier = $identifier;
203
204
        return $this;
205
    }
206
207
    /**
208
     * setArgs function.
209
     *
210
     * @access public
211
     * @param mixed $args
212
     * @return $this
213
     */
214
    public function setArgs($args)
215
    {
216
        $this->args = $args;
217
218
        return $this;
219
    }
220
221
    /**
222
     * getArgs function.
223
     *
224
     * @access public
225
     * @return array
226
     */
227
    public function getArgs()
228
    {
229
        return $this->args;
230
    }
231
}
232