1 | <?php declare(strict_types=1); |
||
12 | class Route implements |
||
13 | MiddlewareInterface, |
||
14 | MiddlewareAwareInterface, |
||
15 | RouteConditionHandlerInterface, |
||
16 | StrategyAwareInterface |
||
17 | { |
||
18 | use MiddlewareAwareTrait; |
||
19 | use RouteConditionHandlerTrait; |
||
20 | use StrategyAwareTrait; |
||
21 | |||
22 | /** |
||
23 | * @var callable|string |
||
24 | */ |
||
25 | protected $handler; |
||
26 | |||
27 | /** |
||
28 | * @var \League\Route\RouteGroup |
||
29 | */ |
||
30 | protected $group; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | protected $method; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $path; |
||
41 | |||
42 | /** |
||
43 | * @var array |
||
44 | */ |
||
45 | protected $vars = []; |
||
46 | |||
47 | 40 | public function __construct(string $method, string $path, $handler) |
|
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | 10 | public function process( |
|
63 | |||
64 | /** |
||
65 | * Get the callable. |
||
66 | * |
||
67 | * @param \Psr\Container\ContainerInterface $container |
||
68 | * |
||
69 | * @throws \RuntimeException |
||
70 | * |
||
71 | * @return callable |
||
72 | */ |
||
73 | 24 | public function getCallable(?ContainerInterface $container = null) : callable |
|
107 | |||
108 | /** |
||
109 | * Return vars to be passed to route callable. |
||
110 | * |
||
111 | * @return array |
||
112 | */ |
||
113 | 12 | public function getVars() : array |
|
117 | |||
118 | /** |
||
119 | * Set vars to be passed to route callable. |
||
120 | * |
||
121 | * @param array $vars |
||
122 | * |
||
123 | * @return \League\Route\Route |
||
124 | */ |
||
125 | 12 | public function setVars(array $vars) : self |
|
131 | |||
132 | /** |
||
133 | * Get the parent group. |
||
134 | * |
||
135 | * @return \League\Route\RouteGroup |
||
136 | */ |
||
137 | 12 | public function getParentGroup() : ?RouteGroup |
|
141 | |||
142 | /** |
||
143 | * Set the parent group. |
||
144 | * |
||
145 | * @param \League\Route\RouteGroup $group |
||
146 | * |
||
147 | * @return \League\Route\Route |
||
148 | */ |
||
149 | 6 | public function setParentGroup(RouteGroup $group) : self |
|
155 | |||
156 | /** |
||
157 | * Get the path. |
||
158 | * |
||
159 | * @return string |
||
160 | */ |
||
161 | 20 | public function getPath() : string |
|
165 | |||
166 | /** |
||
167 | * Get the methods. |
||
168 | * |
||
169 | * @return string |
||
170 | */ |
||
171 | 20 | public function getMethod() : string |
|
175 | } |
||
176 |