1 | <?php |
||
18 | class Server { |
||
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 EndpointFactory $endpointFactory |
||
41 | */ |
||
42 | 6 | public function __construct(AccessControl $accessControl, Throttle $throttle, ResponseFactory $responseFactory, EndpointFactory $endpointFactory){ |
|
48 | |||
49 | /** |
||
50 | * @param Request $request |
||
51 | * @return Response |
||
52 | * @throws AccessDeniedException |
||
53 | * @throws ThrottleLimitExceededException |
||
54 | * @throws UnknownEndpointException |
||
55 | * @throws MethodNotFoundException |
||
56 | * @throws NotAcceptableResponseTypeException |
||
57 | */ |
||
58 | 6 | public function handleRequest(Request $request): Response { |
|
77 | |||
78 | /** |
||
79 | * @param Request $request |
||
80 | * @throws InvalidAPIKeyException |
||
81 | */ |
||
82 | 6 | protected function validateKey(Request $request){ |
|
87 | |||
88 | /** |
||
89 | * @param Request $request |
||
90 | * @throws NotAcceptableResponseTypeException |
||
91 | */ |
||
92 | //TODO: Handle wildcards in request MIME types (*/*) |
||
93 | 4 | protected function validateAcceptableMIMETypes(Request $request) { |
|
101 | } |
||
102 |