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 | * |
||
52 | * @return array |
||
53 | */ |
||
54 | 4 | protected function getParams(Route $route): array |
|
60 | |||
61 | /** |
||
62 | * @param ServerRequestInterface $request |
||
63 | * |
||
64 | * @return callable |
||
65 | * @throws \BadMethodCallException |
||
66 | */ |
||
67 | 1 | protected function getPoint(ServerRequestInterface $request): callable |
|
79 | |||
80 | 2 | protected function getControllerClass(ServerRequestInterface $request): string |
|
84 | |||
85 | /** |
||
86 | * @param string $controller |
||
87 | * |
||
88 | * @throws \BadMethodCallException |
||
89 | */ |
||
90 | 2 | protected function checkController(string $controller): void |
|
96 | |||
97 | /** |
||
98 | * @param \object $controller |
||
99 | * @param string $action |
||
100 | * |
||
101 | * @throws \BadMethodCallException |
||
102 | */ |
||
103 | 4 | protected function checkAction($controller, string $action): void |
|
109 | |||
110 | 4 | protected function getAction(ServerRequestInterface $request): ?string |
|
116 | |||
117 | 1 | protected function getRoute(ServerRequestInterface $request): Route |
|
121 | } |
||
122 |