1 | <?php |
||
11 | class EndPoint implements RequestHandlerInterface |
||
12 | { |
||
13 | /** @var string|null */ |
||
14 | protected $controller; |
||
15 | /** @var string|null */ |
||
16 | protected $action; |
||
17 | |||
18 | 1 | public function __construct(array $params = []) |
|
26 | |||
27 | /** |
||
28 | * @param ServerRequestInterface $request |
||
29 | * |
||
30 | * @return ResponseInterface |
||
31 | * @throws \BadMethodCallException |
||
32 | */ |
||
33 | 1 | public function handle(ServerRequestInterface $request): ResponseInterface |
|
41 | |||
42 | 1 | protected function setProperty(string $name, $value): void |
|
46 | |||
47 | /** |
||
48 | * Get params from router and remove all protected params (_controller/_action/_other) |
||
49 | * |
||
50 | * @param Route $route |
||
51 | * @return array |
||
52 | */ |
||
53 | 4 | protected function getParams(Route $route): array |
|
59 | |||
60 | /** |
||
61 | * @param ServerRequestInterface $request |
||
62 | * |
||
63 | * @return callable |
||
64 | * @throws \BadMethodCallException |
||
65 | */ |
||
66 | 1 | protected function getPoint(ServerRequestInterface $request) : callable |
|
78 | |||
79 | 2 | protected function getControllerClass(ServerRequestInterface $request): string |
|
83 | |||
84 | /** |
||
85 | * @param string $controller |
||
86 | * @throws \BadMethodCallException |
||
87 | */ |
||
88 | 2 | protected function checkController(string $controller) : void |
|
94 | |||
95 | /** |
||
96 | * @param \object $controller |
||
97 | * @param string $action |
||
98 | * @throws \BadMethodCallException |
||
99 | */ |
||
100 | 4 | protected function checkAction($controller, string $action) : void |
|
106 | |||
107 | 4 | protected function getAction(ServerRequestInterface $request): ?string |
|
113 | |||
114 | 1 | protected function getRoute(ServerRequestInterface $request): Route |
|
118 | } |
||
119 |