Ejemplo n.º 1
0
 /**
  * @param ApiModel $dokapiApi dokapiApi
  *
  * @return Model\Resource
  */
 private function generateApiDocs(ApiModel $dokapiApi)
 {
     $resource = new Model\Resource();
     $resource->setApiVersion($dokapiApi->getVersion());
     $resource->setBasePath($dokapiApi->getPath());
     foreach ($dokapiApi->getResources() as $dokapiResource) {
         $api = new Model\Api();
         $api->setPath($dokapiApi->getDocPath() . $dokapiResource->getId());
         $api->setDescription($dokapiResource->getDescription());
         $resource->addApi($api);
     }
     return $resource;
 }
 /**
  * Here we'll check for each resource and routes
  * and build Api->Resource->Operation tree by version.
  *
  * {@inheritdoc}
  */
 public function process($context, Result $result, Collection $collection)
 {
     $versions = $this->getAllVersions($result);
     asort($versions);
     foreach ($versions as $version) {
         $api = new Api($version);
         $api->setPath($this->host);
         $api->setVersion($version);
         foreach ($this->produce as $produce) {
             $api->addProduce($produce);
         }
         foreach ($this->consume as $consume) {
             $api->addConsume($consume);
         }
         foreach ($this->getResourcesForVersion($version, $result) as $resource) {
             $api->addResource($resource);
         }
         $result->set('api', $api->getId(), $api);
     }
 }