Guest User

Untitled

a guest
Jan 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. if($root === false) {
  2. throw new NoResponseException("Could not load swagger root file");
  3. } elseif($root === null || !isset($root->apis) || !is_array($root->apis) || !isset($root->basePath)) {
  4. throw new InvalidSwaggerFormatException("Invalid swagger file");
  5. } else {
  6. if(!in_array('application/json', $root->produces)) {
  7. throw new RequirementsException("API does not produce JSON");
  8. } else {
  9. foreach($root->apis as $api) {
  10. $name = explode('.', basename($api->path))[0];
  11. $cache[$name] = $root->basePath . str_replace("{format}", "json", $api->path);
  12. }
  13. }
  14. }
  15. return $cache;
  16. }
Add Comment
Please, Sign In to add comment