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 | 24 | public function getApi(string $method, int $version, string $package, ?string $apiAction = null) |
|
49 | |||
50 | 3 | public function enableGlobalPreflight(ApiHandlerInterface $corsHandler = null) |
|
57 | |||
58 | /** |
||
59 | * @deprecated use addApi instead |
||
60 | */ |
||
61 | public function addApiHandler(EndpointInterface $endpointIdentifier, ApiHandlerInterface $handler, ApiAuthorizationInterface $apiAuthorization) |
||
65 | |||
66 | /** |
||
67 | * Register new api handler |
||
68 | * |
||
69 | * @param EndpointInterface $endpointIdentifier |
||
70 | * @param ApiHandlerInterface $handler |
||
71 | * @param ApiAuthorizationInterface $apiAuthorization |
||
72 | * @return self |
||
73 | */ |
||
74 | 24 | public function addApi(EndpointInterface $endpointIdentifier, ApiHandlerInterface $handler, ApiAuthorizationInterface $apiAuthorization): self |
|
79 | |||
80 | /** |
||
81 | * Get all registered apis |
||
82 | * |
||
83 | * @return Api[] |
||
84 | */ |
||
85 | 12 | public function getApis(): array |
|
89 | } |
||
90 |