diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index c8b16b46052..cc74dfd3a2a 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -131,7 +131,7 @@ use \{{invokerPackage}}\ObjectSerializer; } {{/maxLength}} {{#minLength}} - if (strlen(${{paramName}}) > {{minLength}}) { + if (strlen(${{paramName}}) < {{minLength}}) { throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); } {{/minLength}} diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index 0ccf65862e7..d17c76c137e 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -147,10 +147,115 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple {{/discriminator}} if ($data != null) { - {{#vars}}$this->container['{{name}}'] = $data['{{name}}'];{{#hasMore}} - {{/hasMore}}{{/vars}} + {{#vars}} + if (isset($data["{{name}}"])) { + $this->container['{{name}}'] = $data["{{name}}"]; + }{{#hasMore}}{{/hasMore}} + {{/vars}} } } + + /** + * 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->container['{{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->container['{{name}}'], $allowed_values))) { + $invalid_properties[] = "invalid value for '${{name}}', must be one of #{allowed_values}."; + } + {{/isEnum}} + {{#hasValidation}} + {{#maxLength}} + if (strlen($this->container['{{name}}']) > {{maxLength}}) { + $invalid_properties[] = "invalid value for '${{name}}', the character length must be smaller than or equal to {{{maxLength}}}."; + } + {{/maxLength}} + {{#minLength}} + if (strlen($this->container['{{name}}']) < {{minLength}}) { + $invalid_properties[] = "invalid value for '${{name}}', the character length must be bigger than or equal to {{{minLength}}}."; + } + {{/minLength}} + {{#maximum}} + if ($this->container['{{name}}'] > {{maximum}}) { + $invalid_properties[] = "invalid value for '${{name}}', must be smaller than or equal to {{maximum}}."; + } + {{/maximum}} + {{#minimum}} + if ($this->container['{{name}}'] < {{minimum}}) { + $invalid_properties[] = "invalid value for '${{name}}', must be bigger than or equal to {{minimum}}."; + } + {{/minimum}} + {{#pattern}} + if (!preg_match("{{pattern}}", $this->container['{{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 + * + * @return bool [description] + */ + public function valid() + { + {{#vars}} + {{#required}} + if ($this->container['{{name}}'] === null) { + return false; + }{{/required}} + {{#isEnum}} + $allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); + if (!in_array($this->container['{{name}}'], $allowed_values))) { + return false; + }{{/isEnum}} + {{#hasValidation}} + {{#maxLength}} + if (strlen($this->container['{{name}}']) > {{maxLength}}) { + return false; + } + {{/maxLength}} + {{#minLength}} + if (strlen($this->container['{{name}}']) < {{minLength}}) { + return false; + } + {{/minLength}} + {{#maximum}} + if ($this->container['{{name}}'] > {{maximum}}) { + return false; + } + {{/maximum}} + {{#minimum}} + if ($this->container['{{name}}'] < {{minimum}}) { + return false; + } + {{/minimum}} + {{#pattern}} + if (!preg_match("{{pattern}}", $this->container['{{name}}'])) { + return false; + } + {{/pattern}} + {{/hasValidation}} + {{/vars}} + return true; + } + + {{#vars}} /** * Gets {{name}} @@ -168,11 +273,40 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple */ public function {{setter}}(${{name}}) { - {{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); + {{#isEnum}} + $allowed_values = array({{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}); if (!in_array(${{{name}}}, $allowed_values)) { throw new \InvalidArgumentException("Invalid value for '{{name}}', must be one of {{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}"); - }{{/isEnum}} + } + {{/isEnum}} + {{#hasValidation}} + {{#maxLength}} + if (strlen(${{name}}) > {{maxLength}}) { + throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); + }{{/maxLength}} + {{#minLength}} + if (strlen(${{name}}) < {{minLength}}) { + throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); + } + {{/minLength}} + {{#maximum}} + if (${{name}} > {{maximum}}) { + throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maximum}}.'); + } + {{/maximum}} + {{#minimum}} + if (${{name}} < {{minimum}}) { + throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minimum}}.'); + } + {{/minimum}} + {{#pattern}} + if (!preg_match("{{pattern}}", ${{name}})) { + throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be conform to the pattern {{pattern}}.'); + } + {{/pattern}} + {{/hasValidation}} $this->container['{{name}}'] = ${{name}}; + return $this; } {{/vars}} diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index a5cba5dcbb7..6aea5f66866 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -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-05-06T10:33:16.765+08:00 +- Build date: 2016-05-07T10:11:34.658Z - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md b/samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md new file mode 100644 index 00000000000..67f017becd0 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md @@ -0,0 +1,9 @@ +# EnumClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.md b/samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.md new file mode 100644 index 00000000000..2ef9e6adaac --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.md @@ -0,0 +1,12 @@ +# EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enum_string** | **string** | | [optional] +**enum_integer** | **int** | | [optional] +**enum_number** | **double** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index 376572544de..9d0456ffb2e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -198,7 +198,7 @@ public function testEndpointParametersWithHttpInfo($number, $double, $string, $b 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.'); } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php index 9e91fa7f02c..e537ef93414 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -128,9 +128,42 @@ public function __construct(array $data = null) $this->container[$discrimintor] = static::$swaggerModelName; if ($data != null) { - $this->container['class_name'] = $data['class_name']; + if (isset($data["class_name"])) { + $this->container['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->container['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->container['class_name'] === null) { + return false; + } + + return true; + } + + /** * Gets class_name * @return string @@ -147,8 +180,8 @@ public function getClassName() */ public function setClassName($class_name) { - $this->container['class_name'] = $class_name; + return $this; } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php index b5e1ff9b81b..dc7190652bc 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php @@ -119,9 +119,32 @@ public function __construct(array $data = null) if ($data != null) { - } } + + /** + * 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; + } + + /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php index 1d37832505d..0c7e225d120 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php @@ -145,11 +145,47 @@ public function __construct(array $data = null) if ($data != null) { - $this->container['code'] = $data['code']; - $this->container['type'] = $data['type']; - $this->container['message'] = $data['message']; + if (isset($data["code"])) { + $this->container['code'] = $data["code"]; + } + if (isset($data["type"])) { + $this->container['type'] = $data["type"]; + } + if (isset($data["message"])) { + $this->container['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 @@ -166,8 +202,8 @@ public function getCode() */ public function setCode($code) { - $this->container['code'] = $code; + return $this; } /** @@ -186,8 +222,8 @@ public function getType() */ public function setType($type) { - $this->container['type'] = $type; + return $this; } /** @@ -206,8 +242,8 @@ public function getMessage() */ public function setMessage($message) { - $this->container['message'] = $message; + return $this; } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php index c22f5c0f6d9..e40d5e969bf 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php @@ -125,9 +125,37 @@ public function __construct(array $data = null) parent::__construct($data); if ($data != null) { - $this->container['declawed'] = $data['declawed']; + if (isset($data["declawed"])) { + $this->container['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 @@ -144,8 +172,8 @@ public function getDeclawed() */ public function setDeclawed($declawed) { - $this->container['declawed'] = $declawed; + return $this; } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php index 567ac3f876a..99c309f6c7e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php @@ -135,10 +135,42 @@ public function __construct(array $data = null) if ($data != null) { - $this->container['id'] = $data['id']; - $this->container['name'] = $data['name']; + if (isset($data["id"])) { + $this->container['id'] = $data["id"]; + } + if (isset($data["name"])) { + $this->container['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 @@ -155,8 +187,8 @@ public function getId() */ public function setId($id) { - $this->container['id'] = $id; + return $this; } /** @@ -175,8 +207,8 @@ public function getName() */ public function setName($name) { - $this->container['name'] = $name; + return $this; } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php index bb40336e609..9999bbba51c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php @@ -125,9 +125,37 @@ public function __construct(array $data = null) parent::__construct($data); if ($data != null) { - $this->container['breed'] = $data['breed']; + if (isset($data["breed"])) { + $this->container['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 @@ -144,8 +172,8 @@ public function getBreed() */ public function setBreed($breed) { - $this->container['breed'] = $breed; + return $this; } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php new file mode 100644 index 00000000000..00b4a894af0 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php @@ -0,0 +1,205 @@ +container[$offset]); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } + + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php new file mode 100644 index 00000000000..50d0069dea2 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php @@ -0,0 +1,378 @@ + 'string', + 'enum_integer' => 'int', + 'enum_number' => 'double' + ); + + static function swaggerTypes() { + return self::$swaggerTypes; + } + + /** + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ + static $attributeMap = array( + 'enum_string' => 'enum_string', + 'enum_integer' => 'enum_integer', + 'enum_number' => 'enum_number' + ); + + static function attributeMap() { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + static $setters = array( + 'enum_string' => 'setEnumString', + 'enum_integer' => 'setEnumInteger', + 'enum_number' => 'setEnumNumber' + ); + + static function setters() { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + static $getters = array( + 'enum_string' => 'getEnumString', + 'enum_integer' => 'getEnumInteger', + 'enum_number' => 'getEnumNumber' + ); + + static function getters() { + return self::$getters; + } + + const ENUM_STRING_UPPER = 'UPPER'; + const ENUM_STRING_LOWER = 'lower'; + const ENUM_INTEGER_1 = 1; + const ENUM_INTEGER_MINUS_1 = -1; + const ENUM_NUMBER_1_DOT_1 = 1.1; + const ENUM_NUMBER_MINUS_1_DOT_2 = -1.2; + + + + /** + * Gets allowable values of the enum + * @return string[] + */ + public function getEnumStringAllowableValues() { + return [ + self::ENUM_STRING_UPPER, + self::ENUM_STRING_LOWER, + ]; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public function getEnumIntegerAllowableValues() { + return [ + self::ENUM_INTEGER_1, + self::ENUM_INTEGER_MINUS_1, + ]; + } + + /** + * Gets allowable values of the enum + * @return string[] + */ + public function getEnumNumberAllowableValues() { + return [ + self::ENUM_NUMBER_1_DOT_1, + self::ENUM_NUMBER_MINUS_1_DOT_2, + ]; + } + + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = array( + /** + * $container['enum_string'] + * @var string + */ + 'enum_string' => null, + + /** + * $container['enum_integer'] + * @var int + */ + 'enum_integer' => null, + + /** + * $container['enum_number'] + * @var double + */ + 'enum_number' => null, + ); + + /** + * Constructor + * @param mixed[] $data Associated array of property value initalizing the model + */ + public function __construct(array $data = null) + { + + + if ($data != null) { + if (isset($data["enum_string"])) { + $this->container['enum_string'] = $data["enum_string"]; + } + if (isset($data["enum_integer"])) { + $this->container['enum_integer'] = $data["enum_integer"]; + } + if (isset($data["enum_number"])) { + $this->container['enum_number'] = $data["enum_number"]; + } + } + } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function list_invalid_properties() + { + $invalid_properties = array(); + $allowed_values = array("UPPER", "lower"); + if (!in_array($this->container['enum_string'], $allowed_values))) { + $invalid_properties[] = "invalid value for '$enum_string', must be one of #{allowed_values}."; + } + $allowed_values = array("1", "-1"); + if (!in_array($this->container['enum_integer'], $allowed_values))) { + $invalid_properties[] = "invalid value for '$enum_integer', must be one of #{allowed_values}."; + } + $allowed_values = array("1.1", "-1.2"); + if (!in_array($this->container['enum_number'], $allowed_values))) { + $invalid_properties[] = "invalid value for '$enum_number', 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("UPPER", "lower"); + if (!in_array($this->container['enum_string'], $allowed_values))) { + return false; + } + + $allowed_values = array("1", "-1"); + if (!in_array($this->container['enum_integer'], $allowed_values))) { + return false; + } + + $allowed_values = array("1.1", "-1.2"); + if (!in_array($this->container['enum_number'], $allowed_values))) { + return false; + } + return true; + } + + + /** + * Gets enum_string + * @return string + */ + public function getEnumString() + { + return $this->container['enum_string']; + } + + /** + * Sets enum_string + * @param string $enum_string + * @return $this + */ + public function setEnumString($enum_string) + { + $allowed_values = array('UPPER', 'lower'); + if (!in_array($enum_string, $allowed_values)) { + throw new \InvalidArgumentException("Invalid value for 'enum_string', must be one of 'UPPER', 'lower'"); + } + $this->container['enum_string'] = $enum_string; + + return $this; + } + /** + * Gets enum_integer + * @return int + */ + public function getEnumInteger() + { + return $this->container['enum_integer']; + } + + /** + * Sets enum_integer + * @param int $enum_integer + * @return $this + */ + public function setEnumInteger($enum_integer) + { + $allowed_values = array('1', '-1'); + if (!in_array($enum_integer, $allowed_values)) { + throw new \InvalidArgumentException("Invalid value for 'enum_integer', must be one of '1', '-1'"); + } + $this->container['enum_integer'] = $enum_integer; + + return $this; + } + /** + * Gets enum_number + * @return double + */ + public function getEnumNumber() + { + return $this->container['enum_number']; + } + + /** + * Sets enum_number + * @param double $enum_number + * @return $this + */ + public function setEnumNumber($enum_number) + { + $allowed_values = array('1.1', '-1.2'); + if (!in_array($enum_number, $allowed_values)) { + throw new \InvalidArgumentException("Invalid value for 'enum_number', must be one of '1.1', '-1.2'"); + } + $this->container['enum_number'] = $enum_number; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * @param integer $offset Offset + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } + + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } +} diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php index 1ceace44c36..7a99d042353 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -245,21 +245,195 @@ public function __construct(array $data = null) if ($data != null) { - $this->container['integer'] = $data['integer']; - $this->container['int32'] = $data['int32']; - $this->container['int64'] = $data['int64']; - $this->container['number'] = $data['number']; - $this->container['float'] = $data['float']; - $this->container['double'] = $data['double']; - $this->container['string'] = $data['string']; - $this->container['byte'] = $data['byte']; - $this->container['binary'] = $data['binary']; - $this->container['date'] = $data['date']; - $this->container['date_time'] = $data['date_time']; - $this->container['uuid'] = $data['uuid']; - $this->container['password'] = $data['password']; + if (isset($data["integer"])) { + $this->container['integer'] = $data["integer"]; + } + if (isset($data["int32"])) { + $this->container['int32'] = $data["int32"]; + } + if (isset($data["int64"])) { + $this->container['int64'] = $data["int64"]; + } + if (isset($data["number"])) { + $this->container['number'] = $data["number"]; + } + if (isset($data["float"])) { + $this->container['float'] = $data["float"]; + } + if (isset($data["double"])) { + $this->container['double'] = $data["double"]; + } + if (isset($data["string"])) { + $this->container['string'] = $data["string"]; + } + if (isset($data["byte"])) { + $this->container['byte'] = $data["byte"]; + } + if (isset($data["binary"])) { + $this->container['binary'] = $data["binary"]; + } + if (isset($data["date"])) { + $this->container['date'] = $data["date"]; + } + if (isset($data["date_time"])) { + $this->container['date_time'] = $data["date_time"]; + } + if (isset($data["uuid"])) { + $this->container['uuid'] = $data["uuid"]; + } + if (isset($data["password"])) { + $this->container['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->container['integer'] > 100.0) { + $invalid_properties[] = "invalid value for '$integer', must be smaller than or equal to 100.0."; + } + if ($this->container['integer'] < 10.0) { + $invalid_properties[] = "invalid value for '$integer', must be bigger than or equal to 10.0."; + } + if ($this->container['int32'] > 200.0) { + $invalid_properties[] = "invalid value for '$int32', must be smaller than or equal to 200.0."; + } + if ($this->container['int32'] < 20.0) { + $invalid_properties[] = "invalid value for '$int32', must be bigger than or equal to 20.0."; + } + if ($this->container['number'] === null) { + $invalid_properties[] = "'$number' can't be null"; + } + if ($this->container['number'] > 543.2) { + $invalid_properties[] = "invalid value for '$number', must be smaller than or equal to 543.2."; + } + if ($this->container['number'] < 32.1) { + $invalid_properties[] = "invalid value for '$number', must be bigger than or equal to 32.1."; + } + if ($this->container['float'] > 987.6) { + $invalid_properties[] = "invalid value for '$float', must be smaller than or equal to 987.6."; + } + if ($this->container['float'] < 54.3) { + $invalid_properties[] = "invalid value for '$float', must be bigger than or equal to 54.3."; + } + if ($this->container['double'] > 123.4) { + $invalid_properties[] = "invalid value for '$double', must be smaller than or equal to 123.4."; + } + if ($this->container['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->container['string'])) { + $invalid_properties[] = "invalid value for '$string', must be conform to the pattern /[a-z]/i."; + } + if ($this->container['byte'] === null) { + $invalid_properties[] = "'$byte' can't be null"; + } + if ($this->container['date'] === null) { + $invalid_properties[] = "'$date' can't be null"; + } + if ($this->container['password'] === null) { + $invalid_properties[] = "'$password' can't be null"; + } + if (strlen($this->container['password']) > 64) { + $invalid_properties[] = "invalid value for '$password', the character length must be smaller than or equal to 64."; + } + if (strlen($this->container['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->container['integer'] > 100.0) { + return false; + } + if ($this->container['integer'] < 10.0) { + return false; + } + + + if ($this->container['int32'] > 200.0) { + return false; + } + if ($this->container['int32'] < 20.0) { + return false; + } + + + if ($this->container['number'] === null) { + return false; + } + + if ($this->container['number'] > 543.2) { + return false; + } + if ($this->container['number'] < 32.1) { + return false; + } + + + if ($this->container['float'] > 987.6) { + return false; + } + if ($this->container['float'] < 54.3) { + return false; + } + + + if ($this->container['double'] > 123.4) { + return false; + } + if ($this->container['double'] < 67.8) { + return false; + } + + + if (!preg_match("/[a-z]/i", $this->container['string'])) { + return false; + } + if ($this->container['byte'] === null) { + return false; + } + + + + if ($this->container['date'] === null) { + return false; + } + + + + + + if ($this->container['password'] === null) { + return false; + } + + if (strlen($this->container['password']) > 64) { + return false; + } + if (strlen($this->container['password']) < 10) { + return false; + } + return true; + } + + /** * Gets integer * @return int @@ -276,8 +450,15 @@ public function getInteger() */ 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->container['integer'] = $integer; + return $this; } /** @@ -296,8 +477,15 @@ public function getInt32() */ 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->container['int32'] = $int32; + return $this; } /** @@ -316,8 +504,8 @@ public function getInt64() */ public function setInt64($int64) { - $this->container['int64'] = $int64; + return $this; } /** @@ -336,8 +524,15 @@ public function getNumber() */ 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->container['number'] = $number; + return $this; } /** @@ -356,8 +551,15 @@ public function getFloat() */ 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->container['float'] = $float; + return $this; } /** @@ -376,8 +578,15 @@ public function getDouble() */ 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->container['double'] = $double; + return $this; } /** @@ -396,8 +605,12 @@ public function getString() */ 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->container['string'] = $string; + return $this; } /** @@ -416,8 +629,8 @@ public function getByte() */ public function setByte($byte) { - $this->container['byte'] = $byte; + return $this; } /** @@ -436,8 +649,8 @@ public function getBinary() */ public function setBinary($binary) { - $this->container['binary'] = $binary; + return $this; } /** @@ -456,8 +669,8 @@ public function getDate() */ public function setDate($date) { - $this->container['date'] = $date; + return $this; } /** @@ -476,8 +689,8 @@ public function getDateTime() */ public function setDateTime($date_time) { - $this->container['date_time'] = $date_time; + return $this; } /** @@ -496,8 +709,8 @@ public function getUuid() */ public function setUuid($uuid) { - $this->container['uuid'] = $uuid; + return $this; } /** @@ -516,8 +729,14 @@ public function getPassword() */ 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->container['password'] = $password; + return $this; } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php index 98b20ec8640..6884fbaed82 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php @@ -125,9 +125,37 @@ public function __construct(array $data = null) if ($data != null) { - $this->container['name'] = $data['name']; + if (isset($data["name"])) { + $this->container['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 @@ -144,8 +172,8 @@ public function getName() */ public function setName($name) { - $this->container['name'] = $name; + return $this; } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php index 43d4f25cfc8..7f8b7e7296b 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php @@ -125,9 +125,37 @@ public function __construct(array $data = null) if ($data != null) { - $this->container['return'] = $data['return']; + if (isset($data["return"])) { + $this->container['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 @@ -144,8 +172,8 @@ public function getReturn() */ public function setReturn($return) { - $this->container['return'] = $return; + return $this; } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php index ac876c4e741..9420a11796d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -145,11 +145,52 @@ public function __construct(array $data = null) if ($data != null) { - $this->container['name'] = $data['name']; - $this->container['snake_case'] = $data['snake_case']; - $this->container['property'] = $data['property']; + if (isset($data["name"])) { + $this->container['name'] = $data["name"]; + } + if (isset($data["snake_case"])) { + $this->container['snake_case'] = $data["snake_case"]; + } + if (isset($data["property"])) { + $this->container['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->container['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->container['name'] === null) { + return false; + } + + + + + + return true; + } + + /** * Gets name * @return int @@ -166,8 +207,8 @@ public function getName() */ public function setName($name) { - $this->container['name'] = $name; + return $this; } /** @@ -186,8 +227,8 @@ public function getSnakeCase() */ public function setSnakeCase($snake_case) { - $this->container['snake_case'] = $snake_case; + return $this; } /** @@ -206,8 +247,8 @@ public function getProperty() */ public function setProperty($property) { - $this->container['property'] = $property; + return $this; } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php index 15db8d7d7d8..e668f6d432b 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -190,14 +190,69 @@ public function __construct(array $data = null) if ($data != null) { - $this->container['id'] = $data['id']; - $this->container['pet_id'] = $data['pet_id']; - $this->container['quantity'] = $data['quantity']; - $this->container['ship_date'] = $data['ship_date']; - $this->container['status'] = $data['status']; - $this->container['complete'] = $data['complete']; + if (isset($data["id"])) { + $this->container['id'] = $data["id"]; + } + if (isset($data["pet_id"])) { + $this->container['pet_id'] = $data["pet_id"]; + } + if (isset($data["quantity"])) { + $this->container['quantity'] = $data["quantity"]; + } + if (isset($data["ship_date"])) { + $this->container['ship_date'] = $data["ship_date"]; + } + if (isset($data["status"])) { + $this->container['status'] = $data["status"]; + } + if (isset($data["complete"])) { + $this->container['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->container['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->container['status'], $allowed_values))) { + return false; + } + + + return true; + } + + /** * Gets id * @return int @@ -214,8 +269,8 @@ public function getId() */ public function setId($id) { - $this->container['id'] = $id; + return $this; } /** @@ -234,8 +289,8 @@ public function getPetId() */ public function setPetId($pet_id) { - $this->container['pet_id'] = $pet_id; + return $this; } /** @@ -254,8 +309,8 @@ public function getQuantity() */ public function setQuantity($quantity) { - $this->container['quantity'] = $quantity; + return $this; } /** @@ -274,8 +329,8 @@ public function getShipDate() */ public function setShipDate($ship_date) { - $this->container['ship_date'] = $ship_date; + return $this; } /** @@ -299,6 +354,7 @@ public function setStatus($status) throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'placed', 'approved', 'delivered'"); } $this->container['status'] = $status; + return $this; } /** @@ -317,8 +373,8 @@ public function getComplete() */ public function setComplete($complete) { - $this->container['complete'] = $complete; + return $this; } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php index 0f15c9af4e7..c949198e642 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -190,14 +190,79 @@ public function __construct(array $data = null) if ($data != null) { - $this->container['id'] = $data['id']; - $this->container['category'] = $data['category']; - $this->container['name'] = $data['name']; - $this->container['photo_urls'] = $data['photo_urls']; - $this->container['tags'] = $data['tags']; - $this->container['status'] = $data['status']; + if (isset($data["id"])) { + $this->container['id'] = $data["id"]; + } + if (isset($data["category"])) { + $this->container['category'] = $data["category"]; + } + if (isset($data["name"])) { + $this->container['name'] = $data["name"]; + } + if (isset($data["photo_urls"])) { + $this->container['photo_urls'] = $data["photo_urls"]; + } + if (isset($data["tags"])) { + $this->container['tags'] = $data["tags"]; + } + if (isset($data["status"])) { + $this->container['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->container['name'] === null) { + $invalid_properties[] = "'$name' can't be null"; + } + if ($this->container['photo_urls'] === null) { + $invalid_properties[] = "'$photo_urls' can't be null"; + } + $allowed_values = array("available", "pending", "sold"); + if (!in_array($this->container['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->container['name'] === null) { + return false; + } + + if ($this->container['photo_urls'] === null) { + return false; + } + + + + + $allowed_values = array("available", "pending", "sold"); + if (!in_array($this->container['status'], $allowed_values))) { + return false; + } + return true; + } + + /** * Gets id * @return int @@ -214,8 +279,8 @@ public function getId() */ public function setId($id) { - $this->container['id'] = $id; + return $this; } /** @@ -234,8 +299,8 @@ public function getCategory() */ public function setCategory($category) { - $this->container['category'] = $category; + return $this; } /** @@ -254,8 +319,8 @@ public function getName() */ public function setName($name) { - $this->container['name'] = $name; + return $this; } /** @@ -274,8 +339,8 @@ public function getPhotoUrls() */ public function setPhotoUrls($photo_urls) { - $this->container['photo_urls'] = $photo_urls; + return $this; } /** @@ -294,8 +359,8 @@ public function getTags() */ public function setTags($tags) { - $this->container['tags'] = $tags; + return $this; } /** @@ -319,6 +384,7 @@ public function setStatus($status) throw new \InvalidArgumentException("Invalid value for 'status', must be one of 'available', 'pending', 'sold'"); } $this->container['status'] = $status; + return $this; } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php index 628cfd5d263..0e37ecb8f46 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php @@ -125,9 +125,37 @@ public function __construct(array $data = null) if ($data != null) { - $this->container['special_property_name'] = $data['special_property_name']; + if (isset($data["special_property_name"])) { + $this->container['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 @@ -144,8 +172,8 @@ public function getSpecialPropertyName() */ public function setSpecialPropertyName($special_property_name) { - $this->container['special_property_name'] = $special_property_name; + return $this; } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php index f85bd480148..d188cc323e4 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php @@ -135,10 +135,42 @@ public function __construct(array $data = null) if ($data != null) { - $this->container['id'] = $data['id']; - $this->container['name'] = $data['name']; + if (isset($data["id"])) { + $this->container['id'] = $data["id"]; + } + if (isset($data["name"])) { + $this->container['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 @@ -155,8 +187,8 @@ public function getId() */ public function setId($id) { - $this->container['id'] = $id; + return $this; } /** @@ -175,8 +207,8 @@ public function getName() */ public function setName($name) { - $this->container['name'] = $name; + return $this; } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php index 2606c8f515d..58cb418951e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php @@ -195,16 +195,72 @@ public function __construct(array $data = null) if ($data != null) { - $this->container['id'] = $data['id']; - $this->container['username'] = $data['username']; - $this->container['first_name'] = $data['first_name']; - $this->container['last_name'] = $data['last_name']; - $this->container['email'] = $data['email']; - $this->container['password'] = $data['password']; - $this->container['phone'] = $data['phone']; - $this->container['user_status'] = $data['user_status']; + if (isset($data["id"])) { + $this->container['id'] = $data["id"]; + } + if (isset($data["username"])) { + $this->container['username'] = $data["username"]; + } + if (isset($data["first_name"])) { + $this->container['first_name'] = $data["first_name"]; + } + if (isset($data["last_name"])) { + $this->container['last_name'] = $data["last_name"]; + } + if (isset($data["email"])) { + $this->container['email'] = $data["email"]; + } + if (isset($data["password"])) { + $this->container['password'] = $data["password"]; + } + if (isset($data["phone"])) { + $this->container['phone'] = $data["phone"]; + } + if (isset($data["user_status"])) { + $this->container['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 @@ -221,8 +277,8 @@ public function getId() */ public function setId($id) { - $this->container['id'] = $id; + return $this; } /** @@ -241,8 +297,8 @@ public function getUsername() */ public function setUsername($username) { - $this->container['username'] = $username; + return $this; } /** @@ -261,8 +317,8 @@ public function getFirstName() */ public function setFirstName($first_name) { - $this->container['first_name'] = $first_name; + return $this; } /** @@ -281,8 +337,8 @@ public function getLastName() */ public function setLastName($last_name) { - $this->container['last_name'] = $last_name; + return $this; } /** @@ -301,8 +357,8 @@ public function getEmail() */ public function setEmail($email) { - $this->container['email'] = $email; + return $this; } /** @@ -321,8 +377,8 @@ public function getPassword() */ public function setPassword($password) { - $this->container['password'] = $password; + return $this; } /** @@ -341,8 +397,8 @@ public function getPhone() */ public function setPhone($phone) { - $this->container['phone'] = $phone; + return $this; } /** @@ -361,8 +417,8 @@ public function getUserStatus() */ public function setUserStatus($user_status) { - $this->container['user_status'] = $user_status; + return $this; } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php new file mode 100644 index 00000000000..4d901dfd1c9 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php @@ -0,0 +1,70 @@ +