1 | <?php |
||
17 | class GenericServer implements Server |
||
18 | { |
||
19 | /** |
||
20 | * @var AccessControl |
||
21 | */ |
||
22 | protected $accessControl; |
||
23 | /** |
||
24 | * @var Throttle |
||
25 | */ |
||
26 | protected $throttle; |
||
27 | /** |
||
28 | * @var ResponseFactory |
||
29 | */ |
||
30 | protected $responseFactory; |
||
31 | /** |
||
32 | * @var Router |
||
33 | */ |
||
34 | private $router; |
||
35 | |||
36 | /** |
||
37 | * @param AccessControl $accessControl |
||
38 | * @param Throttle $throttle |
||
39 | * @param ResponseFactory $responseFactory |
||
40 | * @param Router $router |
||
41 | */ |
||
42 | 6 | public function __construct( |
|
53 | |||
54 | /** |
||
55 | * @param APIRequest $request |
||
56 | * @return APIResponse |
||
57 | * @throws InvalidAPIKeyException |
||
58 | * @throws AccessDeniedException |
||
59 | * @throws ThrottleLimitExceededException |
||
60 | * @throws UnknownEndpointException |
||
61 | * @throws MethodNotFoundException |
||
62 | * @throws NotAcceptableResponseTypeException |
||
63 | */ |
||
64 | 6 | public function handleRequest(APIRequest $request): APIResponse |
|
84 | |||
85 | /** |
||
86 | * @param APIRequest $request |
||
87 | * @throws InvalidAPIKeyException |
||
88 | */ |
||
89 | 6 | protected function validateKey(APIRequest $request) |
|
95 | |||
96 | /** |
||
97 | * @param APIRequest $request |
||
98 | * @throws NotAcceptableResponseTypeException |
||
99 | */ |
||
100 | //TODO: Handle wildcards in request MIME types (*/*) |
||
101 | 4 | protected function validateAcceptableMIMETypes(APIRequest $request) |
|
112 | } |
||
113 |