1 | <?php |
||
12 | class ApiDecider |
||
13 | { |
||
14 | /** @var Api[] */ |
||
15 | private $apis = []; |
||
16 | |||
17 | /** @var ApiHandlerInterface|null */ |
||
18 | private $globalPreflightHandler = null; |
||
19 | |||
20 | /** |
||
21 | * Get api handler that match input method, version, package and apiAction. |
||
22 | * If decider cannot find handler for given handler, returns defaults. |
||
23 | * |
||
24 | * @param string $method |
||
25 | * @param integer $version |
||
26 | * @param string $package |
||
27 | * @param string $apiAction |
||
28 | * |
||
29 | * @return Api |
||
30 | */ |
||
31 | 27 | public function getApi(string $method, int $version, string $package, ?string $apiAction = null) |
|
49 | |||
50 | 3 | public function enableGlobalPreflight(ApiHandlerInterface $corsHandler = null) |
|
57 | |||
58 | /** |
||
59 | * Register new api handler |
||
60 | * |
||
61 | * @param EndpointInterface $endpointIdentifier |
||
62 | * @param ApiHandlerInterface $handler |
||
63 | * @param ApiAuthorizationInterface $apiAuthorization |
||
64 | * @return self |
||
65 | */ |
||
66 | 27 | public function addApi(EndpointInterface $endpointIdentifier, ApiHandlerInterface $handler, ApiAuthorizationInterface $apiAuthorization): self |
|
71 | |||
72 | /** |
||
73 | * Get all registered apis |
||
74 | * |
||
75 | * @return Api[] |
||
76 | */ |
||
77 | 12 | public function getApis(): array |
|
81 | } |
||
82 |