1 | <?php |
||
23 | class GenericServer implements Server |
||
24 | { |
||
25 | /** |
||
26 | * @var AccessControl |
||
27 | */ |
||
28 | protected $accessControl; |
||
29 | /** |
||
30 | * @var Throttle |
||
31 | */ |
||
32 | protected $throttle; |
||
33 | /** |
||
34 | * @var ResponseFactory |
||
35 | */ |
||
36 | protected $responseFactory; |
||
37 | /** |
||
38 | * @var Router |
||
39 | */ |
||
40 | private $router; |
||
41 | |||
42 | /** |
||
43 | * @param AccessControl $accessControl |
||
44 | * @param Throttle $throttle |
||
45 | * @param ResponseFactory $responseFactory |
||
46 | * @param Router $router |
||
47 | */ |
||
48 | 16 | public function __construct( |
|
59 | |||
60 | /** |
||
61 | * @param APIRequest $request |
||
62 | * @return APIResponse |
||
63 | * @throws UnableToHandleRequestException |
||
64 | * @throws InvalidAPIKeyException |
||
65 | * @throws ThrottleLimitExceededException |
||
66 | * @throws NotAcceptableResponseTypeException |
||
67 | * @throws AccessDeniedException |
||
68 | * @throws UnableToRouteRequestException |
||
69 | * @throws UnableToCreateAPIResponseException |
||
70 | */ |
||
71 | 16 | public function handleRequest(APIRequest $request): APIResponse |
|
91 | |||
92 | /** |
||
93 | * @param APIRequest $request |
||
94 | * @throws InvalidAPIKeyException |
||
95 | */ |
||
96 | 16 | protected function validateKey(APIRequest $request) |
|
102 | |||
103 | /** |
||
104 | * @param APIRequest $request |
||
105 | * @throws NotAcceptableResponseTypeException |
||
106 | */ |
||
107 | 12 | protected function validateAcceptableMIMETypes(APIRequest $request) |
|
121 | } |
||
122 |