1 | <?php |
||
19 | class Server { |
||
20 | /** |
||
21 | * @var AccessControl |
||
22 | */ |
||
23 | protected $accessControl; |
||
24 | /** |
||
25 | * @var Throttle |
||
26 | */ |
||
27 | protected $throttle; |
||
28 | /** |
||
29 | * @var ResponseFactory |
||
30 | */ |
||
31 | protected $responseFactory; |
||
32 | /** |
||
33 | * @var Router |
||
34 | */ |
||
35 | private $router; |
||
36 | |||
37 | /** |
||
38 | * @param AccessControl $accessControl |
||
39 | * @param Throttle $throttle |
||
40 | * @param ResponseFactory $responseFactory |
||
41 | * @param EndpointFactory $endpointFactory |
||
42 | */ |
||
43 | public function __construct(AccessControl $accessControl, Throttle $throttle, ResponseFactory $responseFactory, EndpointFactory $endpointFactory){ |
||
49 | |||
50 | /** |
||
51 | * @param Request $request |
||
52 | * @return Response |
||
53 | * @throws AccessDeniedException |
||
54 | * @throws ThrottleLimitExceededException |
||
55 | * @throws UnknownEndpointException |
||
56 | * @throws MethodNotFoundException |
||
57 | * @throws NotAcceptableResponseTypeException |
||
58 | */ |
||
59 | public function handleRequest(Request $request): Response { |
||
78 | |||
79 | /** |
||
80 | * @param Request $request |
||
81 | * @throws InvalidAPIKeyException |
||
82 | */ |
||
83 | protected function validateKey(Request $request){ |
||
88 | |||
89 | /** |
||
90 | * @param Request $request |
||
91 | * @throws NotAcceptableResponseTypeException |
||
92 | */ |
||
93 | //TODO: Handle wildcards in request MIME types (*/*) |
||
94 | protected function validateAcceptableMIMETypes(Request $request) { |
||
102 | } |
||
103 |