1 | <?php |
||
17 | abstract class Schema |
||
18 | { |
||
19 | protected $jsonFile; |
||
20 | protected $allowNullValues = false; |
||
21 | protected $specificationVersion; |
||
22 | |||
23 | const SWAGGER_PATHS = "paths"; |
||
24 | const SWAGGER_PARAMETERS = "parameters"; |
||
25 | const SWAGGER_COMPONENTS = "components"; |
||
26 | |||
27 | /** |
||
28 | * Returns the major specification version |
||
29 | * @return string |
||
30 | */ |
||
31 | public function getSpecificationVersion() |
||
35 | |||
36 | /** |
||
37 | * Factory function for schemata. |
||
38 | * |
||
39 | * Initialize with schema data, which can be a PHP array or encoded as JSON. |
||
40 | * This determines the type of the schema from the given data. |
||
41 | * |
||
42 | * @param array|string $data |
||
43 | * @param bool $extraArgs |
||
44 | * @return Schema |
||
45 | */ |
||
46 | public static function getInstance($data, $extraArgs = false) |
||
66 | |||
67 | /** |
||
68 | * @param $path |
||
69 | * @param $method |
||
70 | * @return mixed |
||
71 | * @throws DefinitionNotFoundException |
||
72 | * @throws HttpMethodNotFoundException |
||
73 | * @throws InvalidDefinitionException |
||
74 | * @throws NotMatchedException |
||
75 | * @throws PathNotFoundException |
||
76 | */ |
||
77 | public function getPathDefinition($path, $method) |
||
127 | |||
128 | /** |
||
129 | * @param $path |
||
130 | * @param $method |
||
131 | * @param $status |
||
132 | * @return Body |
||
133 | * @throws DefinitionNotFoundException |
||
134 | * @throws HttpMethodNotFoundException |
||
135 | * @throws InvalidDefinitionException |
||
136 | * @throws NotMatchedException |
||
137 | * @throws PathNotFoundException |
||
138 | * @throws \ByJG\ApiTools\Exception\GenericSwaggerException |
||
139 | */ |
||
140 | public function getResponseParameters($path, $method, $status) |
||
158 | |||
159 | /** |
||
160 | * OpenApi 2.0 doesn't describe null values, so this flag defines, |
||
161 | * if match is ok when one of property |
||
162 | * |
||
163 | * @return bool |
||
164 | */ |
||
165 | public function isAllowNullValues() |
||
169 | |||
170 | abstract public function getServerUrl(); |
||
171 | |||
172 | /** |
||
173 | * @param $parameterIn |
||
174 | * @param $parameters |
||
175 | * @param $arguments |
||
176 | * @throws DefinitionNotFoundException |
||
177 | * @throws InvalidDefinitionException |
||
178 | * @throws NotMatchedException |
||
179 | */ |
||
180 | abstract protected function validateArguments($parameterIn, $parameters, $arguments); |
||
181 | |||
182 | abstract public function getBasePath(); |
||
183 | |||
184 | /** |
||
185 | * @param $name |
||
186 | * @return mixed |
||
187 | * @throws DefinitionNotFoundException |
||
188 | * @throws InvalidDefinitionException |
||
189 | */ |
||
190 | abstract public function getDefinition($name); |
||
191 | |||
192 | /** |
||
193 | * @param $path |
||
194 | * @param $method |
||
195 | * @return Body |
||
196 | * @throws HttpMethodNotFoundException |
||
197 | * @throws PathNotFoundException |
||
198 | */ |
||
199 | abstract public function getRequestParameters($path, $method); |
||
200 | } |
||
201 |