Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function process($context, Result $result, Collection $collection)
 {
     $model = $context->getAnnotation()->toModel();
     if ($api = $result->getCurrent('api')) {
         $api->addResource($model);
     }
     $result->set('resource', $model->getId(), $model);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function process($context, Result $result, Collection $collection)
 {
     $model = $context->getAnnotation()->toModel();
     if ($operation = $result->getCurrent('operation')) {
         $operation->addResponse($model);
     }
     $result->set('response', $model->getCode(), $model);
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function process($context, Result $result, Collection $collection)
 {
     $model = $context->getAnnotation()->toModel();
     if ($operation = $result->getCurrent('operation')) {
         $operation->addParameter($model);
     }
     $result->set('parameter', $model->getId(), $model);
 }
Ejemplo n.º 4
0
 /**
  * @param Result $result result
  */
 public function render(Result $result)
 {
     $coll = new DataContainer\ApiCollection();
     foreach ($result->getAll('api') as $dokapiApi) {
         $coll->add($this->getTransformer()->transform($dokapiApi));
     }
     return count($coll) === 1 ? $coll->first() : $coll;
 }
 /**
  * {@inheritdoc}
  */
 public function process($context, Result $result, Collection $collection)
 {
     $model = $result->getCurrent('model');
     if (null === $model) {
         continue;
     }
     $variable = $context->getContext()->getVariable();
     $dataType = $context->getAnnotation()->toModel();
     $model->addProperty($variable, $dataType);
 }
Ejemplo n.º 6
0
 /**
  * {@inheritdoc}
  */
 public function process($context, Result $result, Collection $collection)
 {
     $model = $context->getAnnotation()->toModel();
     if ($model->getId() === null && $context->getContext() instanceof PHPFunction) {
         $model->setId($context->getContext()->getFunction());
     }
     if ($resource = $result->getCurrent('resource')) {
         $resource->addOperation($model);
     }
     $result->set('operation', $model->getId(), $model);
 }
Ejemplo n.º 7
0
 /**
  * {@inheritdoc}
  */
 public function process($context, Result $result, Collection $collection)
 {
     $model = $context->getAnnotation()->toModel();
     $result->set('api', $model->getId(), $model);
 }
 /**
  * @param Result $result result
  */
 private function getAllVersions(Result $result)
 {
     $versions = array();
     foreach ($result->getAll('resource') as $resource) {
         foreach ($resource->getOperations() as $operation) {
             $versions[$operation->getVersion()] = $operation->getVersion();
         }
     }
     return array_values($versions);
 }