1 | <?php |
||
19 | class ApiDefinitionLoader |
||
20 | { |
||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | const PROXY_ROUTE = "3rdparty"; |
||
25 | |||
26 | /** |
||
27 | * @var LoaderInterface |
||
28 | */ |
||
29 | private $definitionLoader; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | private $options; |
||
35 | |||
36 | /** |
||
37 | * @var ApiDefinition |
||
38 | */ |
||
39 | private $definition; |
||
40 | |||
41 | /** |
||
42 | * set loader |
||
43 | * |
||
44 | * @param LoaderInterface $loader loader |
||
45 | * |
||
46 | * @return void |
||
47 | */ |
||
48 | public function setDefinitionLoader($loader) |
||
52 | |||
53 | /** |
||
54 | * set options for the loader |
||
55 | * |
||
56 | * @param array $options options [uri, prefix] |
||
57 | * |
||
58 | * @return void |
||
59 | */ |
||
60 | public function setOption(array $options) |
||
67 | |||
68 | /** |
||
69 | * get the origin service definition |
||
70 | * |
||
71 | * @param bool $forceReload Switch to force a new api definition object will be provided. |
||
72 | * |
||
73 | * @return mixed the origin service definition (type depends on dispersal strategy) |
||
74 | */ |
||
75 | public function getOriginDefinition($forceReload = false) |
||
81 | |||
82 | /** |
||
83 | * get a schema for one endpoint |
||
84 | * |
||
85 | * @param string $endpoint endpoint |
||
86 | * @param bool $forceReload Switch to force a new api definition object will be provided. |
||
87 | * |
||
88 | * @return \stdClass |
||
89 | */ |
||
90 | public function getEndpointSchema($endpoint, $forceReload = false) |
||
96 | |||
97 | /** |
||
98 | * get an endpoint |
||
99 | * |
||
100 | * @param string $endpoint endpoint |
||
101 | * @param boolean $withHost attach host name to the url |
||
102 | * @param bool $forceReload Switch to force a new api definition object will be provided. |
||
103 | * |
||
104 | * @return string |
||
105 | */ |
||
106 | public function getEndpoint($endpoint, $withHost = false, $forceReload = false) |
||
129 | |||
130 | /** |
||
131 | * get all endpoints for an API |
||
132 | * |
||
133 | * @param boolean $withHost attach host name to the url |
||
134 | * @param bool $forceReload Switch to force a new api definition object will be provided. |
||
135 | * |
||
136 | * @return array |
||
137 | */ |
||
138 | public function getAllEndpoints($withHost = false, $forceReload = false) |
||
153 | |||
154 | /** |
||
155 | * internal load method |
||
156 | * |
||
157 | * @param bool $forceReload Switch to force a new api definition object will be provided. |
||
158 | * |
||
159 | * @return void |
||
160 | */ |
||
161 | private function loadApiDefinition($forceReload = false) |
||
171 | } |
||
172 |