Inheritance: implements JsonSerializabl\JsonSerializable
Exemple #1
0
 public function __construct(array $values = array())
 {
     parent::__construct($values);
     if ($this->code !== null) {
         $this->code = (int) $this->code;
     }
 }
Exemple #2
0
 public function jsonSerialize()
 {
     if (Swagger::isPrimitive($this->type)) {
         return parent::jsonSerialize();
     }
     return array('$ref' => $this->type);
 }
Exemple #3
0
 public function setNestedAnnotations($annotations)
 {
     foreach ($annotations as $index => $annotation) {
         if ($annotation instanceof Operations) {
             foreach ($annotation->operations as $operation) {
                 $this->operations[] = $operation;
             }
             unset($annotations[$index]);
         }
     }
     return parent::setNestedAnnotations($annotations);
 }
 /** @inheritdoc */
 public function identity()
 {
     return parent::_identity(['name', 'in']);
 }
Exemple #5
0
 public function jsonSerialize()
 {
     $data = parent::jsonSerialize();
     if (count($this->responseMessages) === 0) {
         unset($data['responseMessages']);
     }
     if (count($this->parameters) === 0) {
         unset($data['parameters']);
     }
     return $data;
 }
Exemple #6
0
 public function jsonSerialize()
 {
     $data = parent::jsonSerialize();
     unset($data['description']);
     if (count($this->models) === 0) {
         unset($data['models']);
     }
     return $data;
 }
Exemple #7
0
 public function __construct(array $values = array())
 {
     parent::__construct($values);
     Swagger::checkDataType($this->type, $this->_context);
     if (is_string($this->enum)) {
         $values = $this->decode($this->enum);
         if (is_object($values)) {
             $this->enum = array();
             foreach ($values as $key => $value) {
                 $this->enum[] = $key . '-' . $value;
             }
         } else {
             $this->enum = $values;
         }
     }
 }
Exemple #8
0
 public function validate($skip = [])
 {
     if (in_array($this, $skip, true)) {
         return true;
     }
     $valid = parent::validate($skip);
     if (!$this->ref && $this->type === 'array' && $this->items === null) {
         Logger::notice('@SWG\\Items() is required when ' . $this->identity() . ' has type "array" in ' . $this->_context);
         $valid = false;
     }
     return $valid;
 }
Exemple #9
0
 /**
  * @return array
  */
 public function jsonSerialize()
 {
     $data = parent::jsonSerialize($this);
     $data['properties'] = array();
     foreach ($this->properties as $property) {
         $data['properties'][$property->name] = $property->jsonSerialize();
     }
     return $data;
 }
Exemple #10
0
 public function validate($parents = [], $skip = [])
 {
     if (in_array($this, $skip, true)) {
         return true;
     }
     $valid = parent::validate($parents, $skip);
     if ($this->responses !== null) {
         foreach ($this->responses as $response) {
             if ($response->response !== 'default' && preg_match('/^[12345]{1}[0-9]{2}$/', $response->response) === 0) {
                 Logger::notice('Invalid value "' . $response->response . '" for ' . $response->_identity([]) . '->response, expecting "default" or a HTTP Status Code in ' . $response->_context);
             }
         }
     }
     return $valid;
 }