1 | <?php |
||
15 | class ApiDefinition |
||
16 | { |
||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $basePath; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $host; |
||
26 | |||
27 | /** |
||
28 | * @var mixed |
||
29 | */ |
||
30 | private $origin; |
||
31 | |||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | private $endpoints = array(); |
||
36 | |||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | private $schemes = array(); |
||
41 | |||
42 | /** |
||
43 | * sets the base path of the api |
||
44 | * |
||
45 | * @param string $basePath API base path |
||
46 | * |
||
47 | * @return void |
||
48 | */ |
||
49 | 1 | public function setBasePath($basePath) |
|
53 | |||
54 | /** |
||
55 | * Gets the API's base path |
||
56 | * |
||
57 | * @return string The base path |
||
58 | */ |
||
59 | public function getBasePath() |
||
63 | |||
64 | /** |
||
65 | * sets the FQDN of the API |
||
66 | * |
||
67 | * @param string $host FQDN |
||
68 | * |
||
69 | * @return void |
||
70 | */ |
||
71 | 4 | public function setHost($host) |
|
75 | |||
76 | /** |
||
77 | * get the FQDN of the API |
||
78 | * |
||
79 | * @return string FQDN |
||
80 | */ |
||
81 | 3 | public function getHost() |
|
85 | |||
86 | /** |
||
87 | * set the origin service definition |
||
88 | * |
||
89 | * @param mixed $origin the origin service definition (type depends on dispersal strategy) |
||
90 | * |
||
91 | * @return void |
||
92 | */ |
||
93 | 1 | public function setOrigin($origin) |
|
97 | |||
98 | /** |
||
99 | * get the origin service definition |
||
100 | * |
||
101 | * @return mixed the origin service definition (type depends on dispersal strategy) |
||
102 | */ |
||
103 | public function getOrigin() |
||
107 | |||
108 | /** |
||
109 | * add an endpoint |
||
110 | * |
||
111 | * @param string $endpoint endpoint |
||
112 | * |
||
113 | * @return void |
||
114 | */ |
||
115 | 4 | public function addEndpoint($endpoint) |
|
119 | |||
120 | /** |
||
121 | * check if an endpoint exists |
||
122 | * |
||
123 | * @param string $endpoint endpoint |
||
124 | * |
||
125 | * @return boolean |
||
126 | */ |
||
127 | 2 | public function hasEndpoint($endpoint) |
|
136 | |||
137 | /** |
||
138 | * get all defined API endpoints |
||
139 | * |
||
140 | * @param boolean $withHost url with hostname |
||
141 | * @param string $prefix add a prefix to the url (blub/endpoint/url) |
||
142 | * @param string $host Host to be used instead of the host defined in the swagger json |
||
143 | * @param bool $withBasePath Defines whether the API's base path should be included or not |
||
144 | * |
||
145 | * @return array |
||
146 | */ |
||
147 | 4 | public function getEndpoints($withHost = true, $prefix = null, $host = '', $withBasePath = true) |
|
166 | |||
167 | /** |
||
168 | * add a schema for an endpoint |
||
169 | * |
||
170 | * @param string $endpoint endpoint |
||
171 | * @param \stdClass $schema schema |
||
172 | * |
||
173 | * @return void |
||
174 | */ |
||
175 | 2 | public function addSchema($endpoint, $schema) |
|
179 | |||
180 | /** |
||
181 | * get a schema for an endpoint |
||
182 | * |
||
183 | * @param string $endpoint endpoint |
||
184 | * |
||
185 | * @return \stdClass |
||
186 | */ |
||
187 | 1 | public function getSchema($endpoint) |
|
200 | } |
||
201 |