1 | <?php |
||
27 | class Dispatcher extends AbstractMiddleware implements MiddlewareInterface |
||
28 | { |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | protected $namespace; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $action; |
||
39 | |||
40 | /** |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $controller; |
||
44 | |||
45 | /** |
||
46 | * @var string |
||
47 | */ |
||
48 | protected $args = []; |
||
49 | |||
50 | /** |
||
51 | * Handles a Request and updated the response |
||
52 | * |
||
53 | * @param ServerRequestInterface $request |
||
54 | * @param ResponseInterface $response |
||
55 | * |
||
56 | * @return ResponseInterface |
||
57 | */ |
||
58 | 10 | public function handle( |
|
81 | |||
82 | /** |
||
83 | * Sets the data values into request |
||
84 | * |
||
85 | * @param ControllerInterface $controller |
||
86 | * @param ServerRequestInterface $request |
||
87 | * |
||
88 | * @return ServerRequestInterface|static |
||
89 | */ |
||
90 | 4 | protected function setViewVars( |
|
101 | |||
102 | /** |
||
103 | * Creates the controller with provided class name |
||
104 | * |
||
105 | * @param string $controller |
||
106 | * |
||
107 | * @return ControllerInterface |
||
108 | */ |
||
109 | 10 | protected function createController($controller) |
|
120 | |||
121 | /** |
||
122 | * Check if class exists |
||
123 | * |
||
124 | * @param string $className |
||
125 | * @return $this|self|Dispatcher |
||
126 | */ |
||
127 | 10 | protected function checkClass($className) |
|
136 | |||
137 | /** |
||
138 | * @param Route $route |
||
139 | * |
||
140 | * @return $this|self|Dispatcher |
||
141 | */ |
||
142 | 10 | protected function setAttributes(Route $route) |
|
158 | |||
159 | /** |
||
160 | * Normalize controller/action names |
||
161 | * |
||
162 | * @param string $name |
||
163 | * @return string |
||
164 | */ |
||
165 | 8 | protected function normalize($name) |
|
172 | |||
173 | /** |
||
174 | * Check if action is defined in the controller |
||
175 | * |
||
176 | * @param string $className |
||
177 | * |
||
178 | * @return Dispatcher |
||
179 | */ |
||
180 | 6 | protected function checkAction($className) |
|
190 | } |