コード例 #1
0
 private function bindModelToResourceList()
 {
     $modelBindedResourceList = array();
     foreach ($this->resourceList as $resource) {
         $modelBindedResource = $resource;
         foreach ($resource['apis'] as $api) {
             foreach ($api['operations'] as $operation) {
                 if (isset($operation['responseClass'])) {
                     $model = TypeUtils::getType($operation['responseClass']);
                     if (false === TypeUtils::isPrimitive($model)) {
                         $modelBindedResource = $this->bindModelToResource($modelBindedResource, $this->modelTable, $model);
                     }
                 }
                 if (isset($operation['parameters'])) {
                     foreach ($operation['parameters'] as $parameter) {
                         $model = $parameter['dataType'];
                         if (false === TypeUtils::isPrimitive($model)) {
                             $modelBindedResource = $this->bindModelToResource($modelBindedResource, $this->modelTable, $model);
                         }
                     }
                 }
             }
         }
         array_push($modelBindedResourceList, $modelBindedResource);
     }
     return $modelBindedResourceList;
 }
コード例 #2
0
 private function setupProperty($value)
 {
     @(list($id, $typeAndDesc) = explode(':', $value, 2));
     if (!isset($typeAndDesc)) {
         die('The type of property ' . $id . ' is empty.');
     }
     @(list($type, $description) = explode(' ', $typeAndDesc, 2));
     if (isset($description)) {
         $this->curParams['description'] = $description;
     }
     $type = trim($type);
     $this->curParams['id'] = $id;
     if (TypeUtils::isArray($type)) {
         if (TypeUtils::isPrimitive(TypeUtils::getType($type))) {
             $itemType = 'type';
         } else {
             $itemType = '$ref';
         }
         $this->curParams['itemType'] = $itemType;
         $this->curParams['items'] = TypeUtils::getType($type);
         $type = 'Array';
     } else {
         if (TypeUtils::isRange($type)) {
             list($min, $max) = TypeUtils::getRange($type);
             $this->curParams['min'] = intval(trim($min));
             $this->curParams['max'] = intval(trim($max));
             $this->curParams['valueType'] = 'RANGE';
             $type = 'int';
         } else {
             if (TypeUtils::isList($type)) {
                 list($type, $values) = TypeUtils::getList($type);
                 $this->curParams['values'] = $values;
                 $this->curParams['valueType'] = "LIST";
             }
         }
     }
     $this->curParams['type'] = $type;
 }