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) |
|
46 | |||
47 | 3 | public function enableGlobalPreflight(ApiHandlerInterface $corsHandler = null) |
|
54 | |||
55 | /** |
||
56 | * @deprecated use addApi instead |
||
57 | */ |
||
58 | public function addApiHandler(EndpointInterface $endpointIdentifier, ApiHandlerInterface $handler, ApiAuthorizationInterface $apiAuthorization) |
||
62 | |||
63 | /** |
||
64 | * Register new api handler |
||
65 | * |
||
66 | * @param EndpointInterface $endpointIdentifier |
||
67 | * @param ApiHandlerInterface $handler |
||
68 | * @param ApiAuthorizationInterface $apiAuthorization |
||
69 | * @return self |
||
70 | */ |
||
71 | 24 | public function addApi(EndpointInterface $endpointIdentifier, ApiHandlerInterface $handler, ApiAuthorizationInterface $apiAuthorization): self |
|
76 | |||
77 | /** |
||
78 | * Get all registered apis |
||
79 | * |
||
80 | * @return Api[] |
||
81 | */ |
||
82 | 12 | public function getApis(): array |
|
86 | } |
||
87 |