1 | <?php |
||
17 | class Server { |
||
18 | /** |
||
19 | * @var AccessControl |
||
20 | */ |
||
21 | protected $accessControl; |
||
22 | /** |
||
23 | * @var Throttle |
||
24 | */ |
||
25 | protected $throttle; |
||
26 | /** |
||
27 | * @var ResponseFactory |
||
28 | */ |
||
29 | protected $responseFactory; |
||
30 | /** |
||
31 | * @var Router |
||
32 | */ |
||
33 | private $router; |
||
34 | |||
35 | /** |
||
36 | * @param AccessControl $accessControl |
||
37 | * @param Throttle $throttle |
||
38 | * @param ResponseFactory $responseFactory |
||
39 | * @param EndpointFactory $endpointFactory |
||
40 | */ |
||
41 | public function __construct(AccessControl $accessControl, Throttle $throttle, ResponseFactory $responseFactory, EndpointFactory $endpointFactory){ |
||
47 | |||
48 | /** |
||
49 | * @param Request $request |
||
50 | * @return Response |
||
51 | * @throws AccessDeniedException |
||
52 | * @throws ThrottleLimitExceededException |
||
53 | * @throws UnknownEndpointException |
||
54 | * @throws MethodNotFoundException |
||
55 | */ |
||
56 | public function handleRequest(Request $request): Response { |
||
75 | |||
76 | /** |
||
77 | * @param Request $request |
||
78 | * @throws InvalidAPIKeyException |
||
79 | */ |
||
80 | protected function validateKey(Request $request){ |
||
85 | |||
86 | /** |
||
87 | * @param Request $request |
||
88 | * @throws UnknownResponseTypeException |
||
89 | */ |
||
90 | protected function validateExtension(Request $request) { |
||
96 | } |
||
97 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.