Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if($root === false) {
- throw new NoResponseException("Could not load swagger root file");
- } elseif($root === null || !isset($root->apis) || !is_array($root->apis) || !isset($root->basePath)) {
- throw new InvalidSwaggerFormatException("Invalid swagger file");
- } else {
- if(!in_array('application/json', $root->produces)) {
- throw new RequirementsException("API does not produce JSON");
- } else {
- foreach($root->apis as $api) {
- $name = explode('.', basename($api->path))[0];
- $cache[$name] = $root->basePath . str_replace("{format}", "json", $api->path);
- }
- }
- }
- return $cache;
- }
Add Comment
Please, Sign In to add comment