1 | <?php |
||
16 | abstract class Schema |
||
17 | { |
||
18 | protected $jsonFile; |
||
19 | protected $allowNullValues = false; |
||
20 | protected $specificationVersion; |
||
21 | |||
22 | const SWAGGER_PATHS = "paths"; |
||
23 | const SWAGGER_PARAMETERS = "parameters"; |
||
24 | const SWAGGER_COMPONENTS = "components"; |
||
25 | |||
26 | /** |
||
27 | * Returns the major specification version |
||
28 | * @return string |
||
29 | */ |
||
30 | public function getSpecificationVersion() |
||
34 | |||
35 | public static function getInstance($jsonFile, $extraArgs = false) |
||
44 | |||
45 | /** |
||
46 | * @param $path |
||
47 | * @param $method |
||
48 | * @return mixed |
||
49 | * @throws DefinitionNotFoundException |
||
50 | * @throws HttpMethodNotFoundException |
||
51 | * @throws InvalidDefinitionException |
||
52 | * @throws NotMatchedException |
||
53 | * @throws PathNotFoundException |
||
54 | */ |
||
55 | public function getPathDefinition($path, $method) |
||
105 | |||
106 | /** |
||
107 | * @param $path |
||
108 | * @param $method |
||
109 | * @param $status |
||
110 | * @return Body |
||
111 | * @throws DefinitionNotFoundException |
||
112 | * @throws HttpMethodNotFoundException |
||
113 | * @throws InvalidDefinitionException |
||
114 | * @throws NotMatchedException |
||
115 | * @throws PathNotFoundException |
||
116 | */ |
||
117 | public function getResponseParameters($path, $method, $status) |
||
134 | |||
135 | /** |
||
136 | * OpenApi 2.0 doesn't describe null values, so this flag defines, |
||
137 | * if match is ok when one of property |
||
138 | * |
||
139 | * @return bool |
||
140 | */ |
||
141 | public function isAllowNullValues() |
||
145 | |||
146 | abstract public function getServerUrl(); |
||
147 | |||
148 | /** |
||
149 | * @param $parameterIn |
||
150 | * @param $parameters |
||
151 | * @param $arguments |
||
152 | * @throws DefinitionNotFoundException |
||
153 | * @throws InvalidDefinitionException |
||
154 | * @throws NotMatchedException |
||
155 | */ |
||
156 | abstract protected function validateArguments($parameterIn, $parameters, $arguments); |
||
157 | |||
158 | abstract public function getBasePath(); |
||
159 | |||
160 | /** |
||
161 | * @param $name |
||
162 | * @return mixed |
||
163 | * @throws DefinitionNotFoundException |
||
164 | * @throws InvalidDefinitionException |
||
165 | */ |
||
166 | abstract public function getDefinition($name); |
||
167 | |||
168 | /** |
||
169 | * @param $path |
||
170 | * @param $method |
||
171 | * @return Body |
||
172 | * @throws HttpMethodNotFoundException |
||
173 | * @throws PathNotFoundException |
||
174 | */ |
||
175 | abstract public function getRequestParameters($path, $method); |
||
176 | } |
||
177 |