1 | <?php |
||
18 | class GenericRouter implements Router |
||
19 | { |
||
20 | /** |
||
21 | * @var EndpointFactory |
||
22 | */ |
||
23 | private $endpointFactory; |
||
24 | |||
25 | /** |
||
26 | * DefaultRouter constructor. |
||
27 | * @param EndpointFactory $endpointFactory |
||
28 | */ |
||
29 | 3 | public function __construct(EndpointFactory $endpointFactory) |
|
33 | |||
34 | /** |
||
35 | * @param APIRequest $request |
||
36 | * @return APIResponseData |
||
37 | * @throws MethodNotFoundException |
||
38 | * @throws ElementNotFoundException |
||
39 | * @throws InvalidRequestException |
||
40 | * @throws ElementConflictException |
||
41 | */ |
||
42 | 3 | public function route(APIRequest $request): APIResponseData |
|
47 | |||
48 | /** |
||
49 | * @param Endpoint $endpoint |
||
50 | * @param APIRequest $request |
||
51 | * @return APIResponseData |
||
52 | * @throws MethodNotFoundException |
||
53 | * @throws ElementNotFoundException |
||
54 | * @throws InvalidRequestException |
||
55 | * @throws ElementConflictException |
||
56 | */ |
||
57 | 3 | protected function executeEndpoint(Endpoint $endpoint, APIRequest $request): APIResponseData |
|
65 | |||
66 | /** |
||
67 | * @param APIRequest $request |
||
68 | * @return string |
||
69 | */ |
||
70 | 3 | protected function mapEndpointMethod(APIRequest $request): string |
|
74 | } |
||
75 |