public function __construct(array $values = array()) { parent::__construct($values); if ($this->code !== null) { $this->code = (int) $this->code; } }
public function jsonSerialize() { if (Swagger::isPrimitive($this->type)) { return parent::jsonSerialize(); } return array('$ref' => $this->type); }
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']); }
public function jsonSerialize() { $data = parent::jsonSerialize(); if (count($this->responseMessages) === 0) { unset($data['responseMessages']); } if (count($this->parameters) === 0) { unset($data['parameters']); } return $data; }
public function jsonSerialize() { $data = parent::jsonSerialize(); unset($data['description']); if (count($this->models) === 0) { unset($data['models']); } return $data; }
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; } } }
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; }
/** * @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; }
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; }