jsonSerialize() public method

Customize the way json_encode() renders the annotations.
public jsonSerialize ( ) : array
return array
Example #1
0
 public function jsonSerialize()
 {
     if (Swagger::isPrimitive($this->type)) {
         return parent::jsonSerialize();
     }
     return array('$ref' => $this->type);
 }
Example #2
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;
 }
Example #3
0
 public function jsonSerialize()
 {
     $data = parent::jsonSerialize();
     unset($data['description']);
     if (count($this->models) === 0) {
         unset($data['models']);
     }
     return $data;
 }
Example #4
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;
 }
Example #5
0
 /** @inheritdoc */
 public function jsonSerialize()
 {
     $data = parent::jsonSerialize();
     unset($data->method);
     unset($data->path);
     return $data;
 }