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