forked from loafle/openapi-generator-original
add validation to model
This commit is contained in:
@@ -135,6 +135,51 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function list_invalid_properties()
|
||||
{
|
||||
$invalid_properties = array();
|
||||
{{#vars}}{{#required}}
|
||||
if ($this->{{name}} === null) {
|
||||
$invalid_properties[] = "'${{name}}' can't be null";
|
||||
}{{/required}}
|
||||
{{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}});
|
||||
if (!in_array($this->{{name}}, $allowed_values))) {
|
||||
$invalid_properties[] = "invalid value for '${{name}}', must be one of #{allowed_values}.";
|
||||
}{{/isEnum}}
|
||||
{{#hasValidation}}
|
||||
{{#maxLength}}
|
||||
if (strlen($this->{{name}}) > {{maxLength}}) {
|
||||
$invalid_properties[] = "invalid value for '${{name}}', the character length must be smaller than or equal to {{{maxLength}}}.";
|
||||
}
|
||||
{{/maxLength}}
|
||||
{{#minLength}}
|
||||
if (strlen($this->{{name}}) < {{minLength}}) {
|
||||
$invalid_properties[] = "invalid value for '${{name}}', the character length must be bigger than or equal to {{{minLength}}}.";
|
||||
}
|
||||
{{/minLength}}
|
||||
{{#maximum}}
|
||||
if ($this->{{name}} > {{maximum}}) {
|
||||
$invalid_properties[] = "invalid value for '${{name}}', must be smaller than or equal to {{maximum}}.";
|
||||
}
|
||||
{{/maximum}}
|
||||
{{#minimum}}
|
||||
if ($this->{{name}} < {{minimum}}) {
|
||||
$invalid_properties[] = "invalid value for '${{name}}', must be bigger than or equal to {{minimum}}.";
|
||||
}
|
||||
{{/minimum}}
|
||||
{{#pattern}}
|
||||
if (!preg_match("{{pattern}}", $this->{{name}})) {
|
||||
$invalid_properties[] = "invalid value for '${{name}}', must be conform to the pattern {{pattern}}.";
|
||||
}
|
||||
{{/pattern}}{{/hasValidation}}{{/vars}}
|
||||
return $invalid_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate all the parameters in the model
|
||||
* return true if all passed
|
||||
@@ -143,12 +188,14 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
{{#vars}}
|
||||
{{#required}}
|
||||
{{#vars}}{{#required}}
|
||||
if ($this->{{name}} === null) {
|
||||
return false;
|
||||
}
|
||||
{{/required}}
|
||||
}{{/required}}
|
||||
{{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}});
|
||||
if (!in_array($this->{{name}}, $allowed_values))) {
|
||||
return false;
|
||||
}{{/isEnum}}
|
||||
{{#hasValidation}}
|
||||
{{#maxLength}}
|
||||
if (strlen($this->{{name}}) > {{maxLength}}) {
|
||||
@@ -174,9 +221,7 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
|
||||
if (!preg_match("{{pattern}}", $this->{{name}})) {
|
||||
return false;
|
||||
}
|
||||
{{/pattern}}
|
||||
{{/hasValidation}}
|
||||
{{/vars}}
|
||||
{{/pattern}}{{/hasValidation}}{{/vars}}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -224,10 +269,9 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
|
||||
{{/minimum}}
|
||||
{{#pattern}}
|
||||
if (!preg_match("{{pattern}}", ${{name}})) {
|
||||
throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must conform to the pattern {{pattern}}.');
|
||||
throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be conform to the pattern {{pattern}}.');
|
||||
}
|
||||
{{/pattern}}
|
||||
{{/hasValidation}}
|
||||
{{/pattern}}{{/hasValidation}}
|
||||
$this->{{name}} = ${{name}};
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git
|
||||
|
||||
- API version: 1.0.0
|
||||
- Package version: 1.0.0
|
||||
- Build date: 2016-04-29T03:01:58.276Z
|
||||
- Build date: 2016-05-05T03:40:26.342Z
|
||||
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -198,7 +198,7 @@ class FakeApi
|
||||
if (strlen($password) > 64) {
|
||||
throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 64.');
|
||||
}
|
||||
if (strlen($password) > 10) {
|
||||
if (strlen($password) < 10) {
|
||||
throw new \InvalidArgumentException('invalid length for "$password" when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.');
|
||||
}
|
||||
|
||||
|
||||
@@ -118,9 +118,47 @@ class Animal implements ArrayAccess
|
||||
$this->{$discrimintor} = static::$swaggerModelName;
|
||||
|
||||
if ($data != null) {
|
||||
$this->class_name = $data["class_name"];
|
||||
if (isset($data["class_name"])) {
|
||||
$this->class_name = $data["class_name"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function list_invalid_properties()
|
||||
{
|
||||
$invalid_properties = array();
|
||||
|
||||
if ($this->class_name === null) {
|
||||
$invalid_properties[] = "'$class_name' can't be null";
|
||||
}
|
||||
|
||||
|
||||
return $invalid_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate all the parameters in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool [description]
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
|
||||
if ($this->class_name === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets class_name
|
||||
* @return string
|
||||
@@ -138,6 +176,7 @@ class Animal implements ArrayAccess
|
||||
public function setClassName($class_name)
|
||||
{
|
||||
|
||||
|
||||
$this->class_name = $class_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -133,11 +133,55 @@ class ApiResponse implements ArrayAccess
|
||||
|
||||
|
||||
if ($data != null) {
|
||||
$this->code = $data["code"];
|
||||
$this->type = $data["type"];
|
||||
$this->message = $data["message"];
|
||||
if (isset($data["code"])) {
|
||||
$this->code = $data["code"];
|
||||
}
|
||||
if (isset($data["type"])) {
|
||||
$this->type = $data["type"];
|
||||
}
|
||||
if (isset($data["message"])) {
|
||||
$this->message = $data["message"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function list_invalid_properties()
|
||||
{
|
||||
$invalid_properties = array();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return $invalid_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate all the parameters in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool [description]
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets code
|
||||
* @return int
|
||||
@@ -155,6 +199,7 @@ class ApiResponse implements ArrayAccess
|
||||
public function setCode($code)
|
||||
{
|
||||
|
||||
|
||||
$this->code = $code;
|
||||
return $this;
|
||||
}
|
||||
@@ -175,6 +220,7 @@ class ApiResponse implements ArrayAccess
|
||||
public function setType($type)
|
||||
{
|
||||
|
||||
|
||||
$this->type = $type;
|
||||
return $this;
|
||||
}
|
||||
@@ -195,6 +241,7 @@ class ApiResponse implements ArrayAccess
|
||||
public function setMessage($message)
|
||||
{
|
||||
|
||||
|
||||
$this->message = $message;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -115,9 +115,41 @@ class Cat extends Animal implements ArrayAccess
|
||||
parent::__construct($data);
|
||||
|
||||
if ($data != null) {
|
||||
$this->declawed = $data["declawed"];
|
||||
if (isset($data["declawed"])) {
|
||||
$this->declawed = $data["declawed"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function list_invalid_properties()
|
||||
{
|
||||
$invalid_properties = array();
|
||||
|
||||
|
||||
|
||||
return $invalid_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate all the parameters in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool [description]
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets declawed
|
||||
* @return bool
|
||||
@@ -135,6 +167,7 @@ class Cat extends Animal implements ArrayAccess
|
||||
public function setDeclawed($declawed)
|
||||
{
|
||||
|
||||
|
||||
$this->declawed = $declawed;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -124,10 +124,48 @@ class Category implements ArrayAccess
|
||||
|
||||
|
||||
if ($data != null) {
|
||||
$this->id = $data["id"];
|
||||
$this->name = $data["name"];
|
||||
if (isset($data["id"])) {
|
||||
$this->id = $data["id"];
|
||||
}
|
||||
if (isset($data["name"])) {
|
||||
$this->name = $data["name"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function list_invalid_properties()
|
||||
{
|
||||
$invalid_properties = array();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return $invalid_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate all the parameters in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool [description]
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
* @return int
|
||||
@@ -145,6 +183,7 @@ class Category implements ArrayAccess
|
||||
public function setId($id)
|
||||
{
|
||||
|
||||
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
@@ -165,6 +204,7 @@ class Category implements ArrayAccess
|
||||
public function setName($name)
|
||||
{
|
||||
|
||||
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -115,9 +115,41 @@ class Dog extends Animal implements ArrayAccess
|
||||
parent::__construct($data);
|
||||
|
||||
if ($data != null) {
|
||||
$this->breed = $data["breed"];
|
||||
if (isset($data["breed"])) {
|
||||
$this->breed = $data["breed"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function list_invalid_properties()
|
||||
{
|
||||
$invalid_properties = array();
|
||||
|
||||
|
||||
|
||||
return $invalid_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate all the parameters in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool [description]
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets breed
|
||||
* @return string
|
||||
@@ -135,6 +167,7 @@ class Dog extends Animal implements ArrayAccess
|
||||
public function setBreed($breed)
|
||||
{
|
||||
|
||||
|
||||
$this->breed = $breed;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -214,20 +214,220 @@ class FormatTest implements ArrayAccess
|
||||
|
||||
|
||||
if ($data != null) {
|
||||
$this->integer = $data["integer"];
|
||||
$this->int32 = $data["int32"];
|
||||
$this->int64 = $data["int64"];
|
||||
$this->number = $data["number"];
|
||||
$this->float = $data["float"];
|
||||
$this->double = $data["double"];
|
||||
$this->string = $data["string"];
|
||||
$this->byte = $data["byte"];
|
||||
$this->binary = $data["binary"];
|
||||
$this->date = $data["date"];
|
||||
$this->date_time = $data["date_time"];
|
||||
$this->password = $data["password"];
|
||||
if (isset($data["integer"])) {
|
||||
$this->integer = $data["integer"];
|
||||
}
|
||||
if (isset($data["int32"])) {
|
||||
$this->int32 = $data["int32"];
|
||||
}
|
||||
if (isset($data["int64"])) {
|
||||
$this->int64 = $data["int64"];
|
||||
}
|
||||
if (isset($data["number"])) {
|
||||
$this->number = $data["number"];
|
||||
}
|
||||
if (isset($data["float"])) {
|
||||
$this->float = $data["float"];
|
||||
}
|
||||
if (isset($data["double"])) {
|
||||
$this->double = $data["double"];
|
||||
}
|
||||
if (isset($data["string"])) {
|
||||
$this->string = $data["string"];
|
||||
}
|
||||
if (isset($data["byte"])) {
|
||||
$this->byte = $data["byte"];
|
||||
}
|
||||
if (isset($data["binary"])) {
|
||||
$this->binary = $data["binary"];
|
||||
}
|
||||
if (isset($data["date"])) {
|
||||
$this->date = $data["date"];
|
||||
}
|
||||
if (isset($data["date_time"])) {
|
||||
$this->date_time = $data["date_time"];
|
||||
}
|
||||
if (isset($data["password"])) {
|
||||
$this->password = $data["password"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function list_invalid_properties()
|
||||
{
|
||||
$invalid_properties = array();
|
||||
|
||||
|
||||
if ($this->integer > 100.0) {
|
||||
$invalid_properties[] = "invalid value for '$integer', must be smaller than or equal to 100.0.";
|
||||
}
|
||||
if ($this->integer < 10.0) {
|
||||
$invalid_properties[] = "invalid value for '$integer', must be bigger than or equal to 10.0.";
|
||||
}
|
||||
|
||||
|
||||
if ($this->int32 > 200.0) {
|
||||
$invalid_properties[] = "invalid value for '$int32', must be smaller than or equal to 200.0.";
|
||||
}
|
||||
if ($this->int32 < 20.0) {
|
||||
$invalid_properties[] = "invalid value for '$int32', must be bigger than or equal to 20.0.";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($this->number === null) {
|
||||
$invalid_properties[] = "'$number' can't be null";
|
||||
}
|
||||
|
||||
if ($this->number > 543.2) {
|
||||
$invalid_properties[] = "invalid value for '$number', must be smaller than or equal to 543.2.";
|
||||
}
|
||||
if ($this->number < 32.1) {
|
||||
$invalid_properties[] = "invalid value for '$number', must be bigger than or equal to 32.1.";
|
||||
}
|
||||
|
||||
|
||||
if ($this->float > 987.6) {
|
||||
$invalid_properties[] = "invalid value for '$float', must be smaller than or equal to 987.6.";
|
||||
}
|
||||
if ($this->float < 54.3) {
|
||||
$invalid_properties[] = "invalid value for '$float', must be bigger than or equal to 54.3.";
|
||||
}
|
||||
|
||||
|
||||
if ($this->double > 123.4) {
|
||||
$invalid_properties[] = "invalid value for '$double', must be smaller than or equal to 123.4.";
|
||||
}
|
||||
if ($this->double < 67.8) {
|
||||
$invalid_properties[] = "invalid value for '$double', must be bigger than or equal to 67.8.";
|
||||
}
|
||||
|
||||
|
||||
if (!preg_match("/[a-z]/i", $this->string)) {
|
||||
$invalid_properties[] = "invalid value for '$string', must be conform to the pattern /[a-z]/i.";
|
||||
}
|
||||
|
||||
if ($this->byte === null) {
|
||||
$invalid_properties[] = "'$byte' can't be null";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->date === null) {
|
||||
$invalid_properties[] = "'$date' can't be null";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->password === null) {
|
||||
$invalid_properties[] = "'$password' can't be null";
|
||||
}
|
||||
|
||||
if (strlen($this->password) > 64) {
|
||||
$invalid_properties[] = "invalid value for '$password', the character length must be smaller than or equal to 64.";
|
||||
}
|
||||
if (strlen($this->password) < 10) {
|
||||
$invalid_properties[] = "invalid value for '$password', the character length must be bigger than or equal to 10.";
|
||||
}
|
||||
|
||||
return $invalid_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate all the parameters in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool [description]
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
|
||||
|
||||
if ($this->integer > 100.0) {
|
||||
return false;
|
||||
}
|
||||
if ($this->integer < 10.0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ($this->int32 > 200.0) {
|
||||
return false;
|
||||
}
|
||||
if ($this->int32 < 20.0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($this->number === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->number > 543.2) {
|
||||
return false;
|
||||
}
|
||||
if ($this->number < 32.1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ($this->float > 987.6) {
|
||||
return false;
|
||||
}
|
||||
if ($this->float < 54.3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ($this->double > 123.4) {
|
||||
return false;
|
||||
}
|
||||
if ($this->double < 67.8) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!preg_match("/[a-z]/i", $this->string)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->byte === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->date === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->password === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strlen($this->password) > 64) {
|
||||
return false;
|
||||
}
|
||||
if (strlen($this->password) < 10) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets integer
|
||||
* @return int
|
||||
@@ -245,6 +445,14 @@ class FormatTest implements ArrayAccess
|
||||
public function setInteger($integer)
|
||||
{
|
||||
|
||||
|
||||
if ($integer > 100.0) {
|
||||
throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be smaller than or equal to 100.0.');
|
||||
}
|
||||
if ($integer < 10.0) {
|
||||
throw new \InvalidArgumentException('invalid value for $integer when calling FormatTest., must be bigger than or equal to 10.0.');
|
||||
}
|
||||
|
||||
$this->integer = $integer;
|
||||
return $this;
|
||||
}
|
||||
@@ -265,6 +473,14 @@ class FormatTest implements ArrayAccess
|
||||
public function setInt32($int32)
|
||||
{
|
||||
|
||||
|
||||
if ($int32 > 200.0) {
|
||||
throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be smaller than or equal to 200.0.');
|
||||
}
|
||||
if ($int32 < 20.0) {
|
||||
throw new \InvalidArgumentException('invalid value for $int32 when calling FormatTest., must be bigger than or equal to 20.0.');
|
||||
}
|
||||
|
||||
$this->int32 = $int32;
|
||||
return $this;
|
||||
}
|
||||
@@ -285,6 +501,7 @@ class FormatTest implements ArrayAccess
|
||||
public function setInt64($int64)
|
||||
{
|
||||
|
||||
|
||||
$this->int64 = $int64;
|
||||
return $this;
|
||||
}
|
||||
@@ -305,6 +522,14 @@ class FormatTest implements ArrayAccess
|
||||
public function setNumber($number)
|
||||
{
|
||||
|
||||
|
||||
if ($number > 543.2) {
|
||||
throw new \InvalidArgumentException('invalid value for $number when calling FormatTest., must be smaller than or equal to 543.2.');
|
||||
}
|
||||
if ($number < 32.1) {
|
||||
throw new \InvalidArgumentException('invalid value for $number when calling FormatTest., must be bigger than or equal to 32.1.');
|
||||
}
|
||||
|
||||
$this->number = $number;
|
||||
return $this;
|
||||
}
|
||||
@@ -325,6 +550,14 @@ class FormatTest implements ArrayAccess
|
||||
public function setFloat($float)
|
||||
{
|
||||
|
||||
|
||||
if ($float > 987.6) {
|
||||
throw new \InvalidArgumentException('invalid value for $float when calling FormatTest., must be smaller than or equal to 987.6.');
|
||||
}
|
||||
if ($float < 54.3) {
|
||||
throw new \InvalidArgumentException('invalid value for $float when calling FormatTest., must be bigger than or equal to 54.3.');
|
||||
}
|
||||
|
||||
$this->float = $float;
|
||||
return $this;
|
||||
}
|
||||
@@ -345,6 +578,14 @@ class FormatTest implements ArrayAccess
|
||||
public function setDouble($double)
|
||||
{
|
||||
|
||||
|
||||
if ($double > 123.4) {
|
||||
throw new \InvalidArgumentException('invalid value for $double when calling FormatTest., must be smaller than or equal to 123.4.');
|
||||
}
|
||||
if ($double < 67.8) {
|
||||
throw new \InvalidArgumentException('invalid value for $double when calling FormatTest., must be bigger than or equal to 67.8.');
|
||||
}
|
||||
|
||||
$this->double = $double;
|
||||
return $this;
|
||||
}
|
||||
@@ -365,6 +606,11 @@ class FormatTest implements ArrayAccess
|
||||
public function setString($string)
|
||||
{
|
||||
|
||||
|
||||
if (!preg_match("/[a-z]/i", $string)) {
|
||||
throw new \InvalidArgumentException('invalid value for $string when calling FormatTest., must be conform to the pattern /[a-z]/i.');
|
||||
}
|
||||
|
||||
$this->string = $string;
|
||||
return $this;
|
||||
}
|
||||
@@ -385,6 +631,7 @@ class FormatTest implements ArrayAccess
|
||||
public function setByte($byte)
|
||||
{
|
||||
|
||||
|
||||
$this->byte = $byte;
|
||||
return $this;
|
||||
}
|
||||
@@ -405,6 +652,7 @@ class FormatTest implements ArrayAccess
|
||||
public function setBinary($binary)
|
||||
{
|
||||
|
||||
|
||||
$this->binary = $binary;
|
||||
return $this;
|
||||
}
|
||||
@@ -425,6 +673,7 @@ class FormatTest implements ArrayAccess
|
||||
public function setDate($date)
|
||||
{
|
||||
|
||||
|
||||
$this->date = $date;
|
||||
return $this;
|
||||
}
|
||||
@@ -445,6 +694,7 @@ class FormatTest implements ArrayAccess
|
||||
public function setDateTime($date_time)
|
||||
{
|
||||
|
||||
|
||||
$this->date_time = $date_time;
|
||||
return $this;
|
||||
}
|
||||
@@ -465,6 +715,13 @@ class FormatTest implements ArrayAccess
|
||||
public function setPassword($password)
|
||||
{
|
||||
|
||||
if (strlen($password) > 64) {
|
||||
throw new \InvalidArgumentException('invalid length for $password when calling FormatTest., must be smaller than or equal to 64.');
|
||||
}
|
||||
if (strlen($password) < 10) {
|
||||
throw new \InvalidArgumentException('invalid length for $password when calling FormatTest., must be bigger than or equal to 10.');
|
||||
}
|
||||
|
||||
$this->password = $password;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -115,9 +115,41 @@ class Model200Response implements ArrayAccess
|
||||
|
||||
|
||||
if ($data != null) {
|
||||
$this->name = $data["name"];
|
||||
if (isset($data["name"])) {
|
||||
$this->name = $data["name"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function list_invalid_properties()
|
||||
{
|
||||
$invalid_properties = array();
|
||||
|
||||
|
||||
|
||||
return $invalid_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate all the parameters in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool [description]
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets name
|
||||
* @return int
|
||||
@@ -135,6 +167,7 @@ class Model200Response implements ArrayAccess
|
||||
public function setName($name)
|
||||
{
|
||||
|
||||
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -115,9 +115,41 @@ class ModelReturn implements ArrayAccess
|
||||
|
||||
|
||||
if ($data != null) {
|
||||
$this->return = $data["return"];
|
||||
if (isset($data["return"])) {
|
||||
$this->return = $data["return"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function list_invalid_properties()
|
||||
{
|
||||
$invalid_properties = array();
|
||||
|
||||
|
||||
|
||||
return $invalid_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate all the parameters in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool [description]
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets return
|
||||
* @return int
|
||||
@@ -135,6 +167,7 @@ class ModelReturn implements ArrayAccess
|
||||
public function setReturn($return)
|
||||
{
|
||||
|
||||
|
||||
$this->return = $return;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -133,11 +133,61 @@ class Name implements ArrayAccess
|
||||
|
||||
|
||||
if ($data != null) {
|
||||
$this->name = $data["name"];
|
||||
$this->snake_case = $data["snake_case"];
|
||||
$this->property = $data["property"];
|
||||
if (isset($data["name"])) {
|
||||
$this->name = $data["name"];
|
||||
}
|
||||
if (isset($data["snake_case"])) {
|
||||
$this->snake_case = $data["snake_case"];
|
||||
}
|
||||
if (isset($data["property"])) {
|
||||
$this->property = $data["property"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function list_invalid_properties()
|
||||
{
|
||||
$invalid_properties = array();
|
||||
|
||||
if ($this->name === null) {
|
||||
$invalid_properties[] = "'$name' can't be null";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return $invalid_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate all the parameters in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool [description]
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
|
||||
if ($this->name === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets name
|
||||
* @return int
|
||||
@@ -155,6 +205,7 @@ class Name implements ArrayAccess
|
||||
public function setName($name)
|
||||
{
|
||||
|
||||
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
@@ -175,6 +226,7 @@ class Name implements ArrayAccess
|
||||
public function setSnakeCase($snake_case)
|
||||
{
|
||||
|
||||
|
||||
$this->snake_case = $snake_case;
|
||||
return $this;
|
||||
}
|
||||
@@ -195,6 +247,7 @@ class Name implements ArrayAccess
|
||||
public function setProperty($property)
|
||||
{
|
||||
|
||||
|
||||
$this->property = $property;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -160,14 +160,82 @@ class Order implements ArrayAccess
|
||||
|
||||
|
||||
if ($data != null) {
|
||||
$this->id = $data["id"];
|
||||
$this->pet_id = $data["pet_id"];
|
||||
$this->quantity = $data["quantity"];
|
||||
$this->ship_date = $data["ship_date"];
|
||||
$this->status = $data["status"];
|
||||
$this->complete = $data["complete"];
|
||||
if (isset($data["id"])) {
|
||||
$this->id = $data["id"];
|
||||
}
|
||||
if (isset($data["pet_id"])) {
|
||||
$this->pet_id = $data["pet_id"];
|
||||
}
|
||||
if (isset($data["quantity"])) {
|
||||
$this->quantity = $data["quantity"];
|
||||
}
|
||||
if (isset($data["ship_date"])) {
|
||||
$this->ship_date = $data["ship_date"];
|
||||
}
|
||||
if (isset($data["status"])) {
|
||||
$this->status = $data["status"];
|
||||
}
|
||||
if (isset($data["complete"])) {
|
||||
$this->complete = $data["complete"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function list_invalid_properties()
|
||||
{
|
||||
$invalid_properties = array();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$allowed_values = array("placed", "approved", "delivered");
|
||||
if (!in_array($this->status, $allowed_values))) {
|
||||
$invalid_properties[] = "invalid value for '$status', must be one of #{allowed_values}.";
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $invalid_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate all the parameters in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool [description]
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$allowed_values = array("placed", "approved", "delivered");
|
||||
if (!in_array($this->status, $allowed_values))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
* @return int
|
||||
@@ -185,6 +253,7 @@ class Order implements ArrayAccess
|
||||
public function setId($id)
|
||||
{
|
||||
|
||||
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
@@ -205,6 +274,7 @@ class Order implements ArrayAccess
|
||||
public function setPetId($pet_id)
|
||||
{
|
||||
|
||||
|
||||
$this->pet_id = $pet_id;
|
||||
return $this;
|
||||
}
|
||||
@@ -225,6 +295,7 @@ class Order implements ArrayAccess
|
||||
public function setQuantity($quantity)
|
||||
{
|
||||
|
||||
|
||||
$this->quantity = $quantity;
|
||||
return $this;
|
||||
}
|
||||
@@ -245,6 +316,7 @@ class Order implements ArrayAccess
|
||||
public function setShipDate($ship_date)
|
||||
{
|
||||
|
||||
|
||||
$this->ship_date = $ship_date;
|
||||
return $this;
|
||||
}
|
||||
@@ -268,6 +340,7 @@ class Order implements ArrayAccess
|
||||
if (!in_array($status, $allowed_values)) {
|
||||
throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'placed', 'approved', 'delivered'");
|
||||
}
|
||||
|
||||
$this->status = $status;
|
||||
return $this;
|
||||
}
|
||||
@@ -288,6 +361,7 @@ class Order implements ArrayAccess
|
||||
public function setComplete($complete)
|
||||
{
|
||||
|
||||
|
||||
$this->complete = $complete;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -160,14 +160,94 @@ class Pet implements ArrayAccess
|
||||
|
||||
|
||||
if ($data != null) {
|
||||
$this->id = $data["id"];
|
||||
$this->category = $data["category"];
|
||||
$this->name = $data["name"];
|
||||
$this->photo_urls = $data["photo_urls"];
|
||||
$this->tags = $data["tags"];
|
||||
$this->status = $data["status"];
|
||||
if (isset($data["id"])) {
|
||||
$this->id = $data["id"];
|
||||
}
|
||||
if (isset($data["category"])) {
|
||||
$this->category = $data["category"];
|
||||
}
|
||||
if (isset($data["name"])) {
|
||||
$this->name = $data["name"];
|
||||
}
|
||||
if (isset($data["photo_urls"])) {
|
||||
$this->photo_urls = $data["photo_urls"];
|
||||
}
|
||||
if (isset($data["tags"])) {
|
||||
$this->tags = $data["tags"];
|
||||
}
|
||||
if (isset($data["status"])) {
|
||||
$this->status = $data["status"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function list_invalid_properties()
|
||||
{
|
||||
$invalid_properties = array();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->name === null) {
|
||||
$invalid_properties[] = "'$name' can't be null";
|
||||
}
|
||||
|
||||
|
||||
if ($this->photo_urls === null) {
|
||||
$invalid_properties[] = "'$photo_urls' can't be null";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$allowed_values = array("available", "pending", "sold");
|
||||
if (!in_array($this->status, $allowed_values))) {
|
||||
$invalid_properties[] = "invalid value for '$status', must be one of #{allowed_values}.";
|
||||
}
|
||||
|
||||
return $invalid_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate all the parameters in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool [description]
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($this->name === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ($this->photo_urls === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$allowed_values = array("available", "pending", "sold");
|
||||
if (!in_array($this->status, $allowed_values))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
* @return int
|
||||
@@ -185,6 +265,7 @@ class Pet implements ArrayAccess
|
||||
public function setId($id)
|
||||
{
|
||||
|
||||
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
@@ -205,6 +286,7 @@ class Pet implements ArrayAccess
|
||||
public function setCategory($category)
|
||||
{
|
||||
|
||||
|
||||
$this->category = $category;
|
||||
return $this;
|
||||
}
|
||||
@@ -225,6 +307,7 @@ class Pet implements ArrayAccess
|
||||
public function setName($name)
|
||||
{
|
||||
|
||||
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
@@ -245,6 +328,7 @@ class Pet implements ArrayAccess
|
||||
public function setPhotoUrls($photo_urls)
|
||||
{
|
||||
|
||||
|
||||
$this->photo_urls = $photo_urls;
|
||||
return $this;
|
||||
}
|
||||
@@ -265,6 +349,7 @@ class Pet implements ArrayAccess
|
||||
public function setTags($tags)
|
||||
{
|
||||
|
||||
|
||||
$this->tags = $tags;
|
||||
return $this;
|
||||
}
|
||||
@@ -288,6 +373,7 @@ class Pet implements ArrayAccess
|
||||
if (!in_array($status, $allowed_values)) {
|
||||
throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'available', 'pending', 'sold'");
|
||||
}
|
||||
|
||||
$this->status = $status;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -115,9 +115,41 @@ class SpecialModelName implements ArrayAccess
|
||||
|
||||
|
||||
if ($data != null) {
|
||||
$this->special_property_name = $data["special_property_name"];
|
||||
if (isset($data["special_property_name"])) {
|
||||
$this->special_property_name = $data["special_property_name"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function list_invalid_properties()
|
||||
{
|
||||
$invalid_properties = array();
|
||||
|
||||
|
||||
|
||||
return $invalid_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate all the parameters in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool [description]
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets special_property_name
|
||||
* @return int
|
||||
@@ -135,6 +167,7 @@ class SpecialModelName implements ArrayAccess
|
||||
public function setSpecialPropertyName($special_property_name)
|
||||
{
|
||||
|
||||
|
||||
$this->special_property_name = $special_property_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -124,10 +124,48 @@ class Tag implements ArrayAccess
|
||||
|
||||
|
||||
if ($data != null) {
|
||||
$this->id = $data["id"];
|
||||
$this->name = $data["name"];
|
||||
if (isset($data["id"])) {
|
||||
$this->id = $data["id"];
|
||||
}
|
||||
if (isset($data["name"])) {
|
||||
$this->name = $data["name"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function list_invalid_properties()
|
||||
{
|
||||
$invalid_properties = array();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return $invalid_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate all the parameters in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool [description]
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
* @return int
|
||||
@@ -145,6 +183,7 @@ class Tag implements ArrayAccess
|
||||
public function setId($id)
|
||||
{
|
||||
|
||||
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
@@ -165,6 +204,7 @@ class Tag implements ArrayAccess
|
||||
public function setName($name)
|
||||
{
|
||||
|
||||
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -178,16 +178,90 @@ class User implements ArrayAccess
|
||||
|
||||
|
||||
if ($data != null) {
|
||||
$this->id = $data["id"];
|
||||
$this->username = $data["username"];
|
||||
$this->first_name = $data["first_name"];
|
||||
$this->last_name = $data["last_name"];
|
||||
$this->email = $data["email"];
|
||||
$this->password = $data["password"];
|
||||
$this->phone = $data["phone"];
|
||||
$this->user_status = $data["user_status"];
|
||||
if (isset($data["id"])) {
|
||||
$this->id = $data["id"];
|
||||
}
|
||||
if (isset($data["username"])) {
|
||||
$this->username = $data["username"];
|
||||
}
|
||||
if (isset($data["first_name"])) {
|
||||
$this->first_name = $data["first_name"];
|
||||
}
|
||||
if (isset($data["last_name"])) {
|
||||
$this->last_name = $data["last_name"];
|
||||
}
|
||||
if (isset($data["email"])) {
|
||||
$this->email = $data["email"];
|
||||
}
|
||||
if (isset($data["password"])) {
|
||||
$this->password = $data["password"];
|
||||
}
|
||||
if (isset($data["phone"])) {
|
||||
$this->phone = $data["phone"];
|
||||
}
|
||||
if (isset($data["user_status"])) {
|
||||
$this->user_status = $data["user_status"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show all the invalid properties with reasons.
|
||||
*
|
||||
* @return array invalid properties with reasons
|
||||
*/
|
||||
public function list_invalid_properties()
|
||||
{
|
||||
$invalid_properties = array();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return $invalid_properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate all the parameters in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool [description]
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
* @return int
|
||||
@@ -205,6 +279,7 @@ class User implements ArrayAccess
|
||||
public function setId($id)
|
||||
{
|
||||
|
||||
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
@@ -225,6 +300,7 @@ class User implements ArrayAccess
|
||||
public function setUsername($username)
|
||||
{
|
||||
|
||||
|
||||
$this->username = $username;
|
||||
return $this;
|
||||
}
|
||||
@@ -245,6 +321,7 @@ class User implements ArrayAccess
|
||||
public function setFirstName($first_name)
|
||||
{
|
||||
|
||||
|
||||
$this->first_name = $first_name;
|
||||
return $this;
|
||||
}
|
||||
@@ -265,6 +342,7 @@ class User implements ArrayAccess
|
||||
public function setLastName($last_name)
|
||||
{
|
||||
|
||||
|
||||
$this->last_name = $last_name;
|
||||
return $this;
|
||||
}
|
||||
@@ -285,6 +363,7 @@ class User implements ArrayAccess
|
||||
public function setEmail($email)
|
||||
{
|
||||
|
||||
|
||||
$this->email = $email;
|
||||
return $this;
|
||||
}
|
||||
@@ -305,6 +384,7 @@ class User implements ArrayAccess
|
||||
public function setPassword($password)
|
||||
{
|
||||
|
||||
|
||||
$this->password = $password;
|
||||
return $this;
|
||||
}
|
||||
@@ -325,6 +405,7 @@ class User implements ArrayAccess
|
||||
public function setPhone($phone)
|
||||
{
|
||||
|
||||
|
||||
$this->phone = $phone;
|
||||
return $this;
|
||||
}
|
||||
@@ -345,6 +426,7 @@ class User implements ArrayAccess
|
||||
public function setUserStatus($user_status)
|
||||
{
|
||||
|
||||
|
||||
$this->user_status = $user_status;
|
||||
return $this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user