From f5a802d9affa461df022893081383e24b0c7d7f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Fri, 6 May 2016 23:36:49 +0200 Subject: [PATCH 1/3] [PHP] Fix default values in derived classes Fixes flaw in 9f40a82310b36764e5d8ee055983c888ac4d88a6. --- .../src/main/resources/php/model.mustache | 33 +++++++++---------- ...ith-fake-endpoints-models-for-testing.yaml | 3 ++ .../SwaggerClient-php/tests/PetApiTest.php | 14 ++++++++ 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache index 0ccf65862e7..3844943005d 100644 --- a/modules/swagger-codegen/src/main/resources/php/model.mustache +++ b/modules/swagger-codegen/src/main/resources/php/model.mustache @@ -36,6 +36,7 @@ namespace {{modelPackage}}; use \ArrayAccess; + /** * {{classname}} Class Doc Comment * @@ -62,7 +63,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple {{#vars}}'{{name}}' => '{{{datatype}}}'{{#hasMore}}, {{/hasMore}}{{/vars}} ); - + static function swaggerTypes() { return self::$swaggerTypes{{#parentSchema}} + parent::swaggerTypes(){{/parentSchema}}; } @@ -75,7 +76,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple {{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}}, {{/hasMore}}{{/vars}} ); - + static function attributeMap() { return {{#parentSchema}}parent::attributeMap() + {{/parentSchema}}self::$attributeMap; } @@ -88,7 +89,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple {{#vars}}'{{name}}' => '{{setter}}'{{#hasMore}}, {{/hasMore}}{{/vars}} ); - + static function setters() { return {{#parentSchema}}parent::setters() + {{/parentSchema}}self::$setters; } @@ -126,13 +127,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple * Associative array for storing property values * @var mixed[] */ - protected $container = array({{#vars}} - /** - * $container['{{{name}}}']{{#description}} {{{description}}}{{/description}} - * @var {{datatype}} - */ - '{{{name}}}' => {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}, - {{/vars}}); + protected $container = array(); /** * Constructor @@ -140,18 +135,22 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple */ public function __construct(array $data = null) { - {{#parentSchema}}parent::__construct($data);{{/parentSchema}} - {{#discriminator}}// Initialize discriminator property with the model name. + {{#parentSchema}} + parent::__construct($data); + + {{/parentSchema}} + {{#vars}} + $this->container['{{name}}'] = isset($data['{{name}}']) ? $data['{{name}}'] : {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}; + {{/vars}} + {{#discriminator}} + + // Initialize discriminator property with the model name. $discrimintor = array_search('{{discriminator}}', self::$attributeMap); $this->container[$discrimintor] = static::$swaggerModelName; {{/discriminator}} - - if ($data != null) { - {{#vars}}$this->container['{{name}}'] = $data['{{name}}'];{{#hasMore}} - {{/hasMore}}{{/vars}} - } } {{#vars}} + /** * Gets {{name}} * @return {{datatype}} diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index 068fb8054d8..1245e50f3b5 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -842,6 +842,9 @@ definitions: properties: className: type: string + color: + type: string + default: 'red' AnimalFarm: type: array items: diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php index 0695eb9d981..9feabf142cf 100644 --- a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php @@ -450,6 +450,20 @@ class PetApiTest extends \PHPUnit_Framework_TestCase } } + // test if default values works + public function testDefaultValues() + { + // add some animals to the farm to make sure the ArrayAccess + // interface works + $dog = new Swagger\Client\Model\Dog(); + $animal = new Swagger\Client\Model\Animal(); + + // assert we can look up the animals in the farm by array + // indices (let's try a random order) + $this->assertSame('red', $dog->getColor()); + $this->assertSame('red', $animal->getColor()); + } + } ?> From bf8b7b760c7b4306610823509c590fbb1083fe19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Fri, 6 May 2016 23:46:02 +0200 Subject: [PATCH 2/3] [PHP] Regenerate petstore sample --- .../petstore/php/SwaggerClient-php/README.md | 14 +- .../php/SwaggerClient-php/docs/Animal.md | 1 + .../docs/{200Response.md => EnumClass.md} | 3 +- .../php/SwaggerClient-php/docs/EnumTest.md | 12 + .../docs/InlineResponse200.md | 15 - .../SwaggerClient-php/lib/Model/Animal.php | 57 ++- .../lib/Model/AnimalFarm.php | 12 +- .../lib/Model/ApiResponse.php | 40 +- .../php/SwaggerClient-php/lib/Model/Cat.php | 22 +- .../SwaggerClient-php/lib/Model/Category.php | 31 +- .../php/SwaggerClient-php/lib/Model/Dog.php | 22 +- .../SwaggerClient-php/lib/Model/EnumClass.php | 178 +++++++++ .../SwaggerClient-php/lib/Model/EnumTest.php | 300 ++++++++++++++ .../lib/Model/FormatTest.php | 130 ++---- .../lib/Model/InlineResponse200.php | 375 ------------------ .../lib/Model/Model200Response.php | 22 +- .../lib/Model/ModelReturn.php | 22 +- .../php/SwaggerClient-php/lib/Model/Name.php | 40 +- .../php/SwaggerClient-php/lib/Model/Order.php | 67 +--- .../php/SwaggerClient-php/lib/Model/Pet.php | 67 +--- .../lib/Model/SpecialModelName.php | 22 +- .../php/SwaggerClient-php/lib/Model/Tag.php | 31 +- .../php/SwaggerClient-php/lib/Model/User.php | 85 +--- .../lib/ObjectSerializer.php | 2 +- ...eResponse200Test.php => EnumClassTest.php} | 10 +- .../lib/Tests/EnumTestTest.php | 70 ++++ 26 files changed, 780 insertions(+), 870 deletions(-) rename samples/client/petstore/php/SwaggerClient-php/docs/{200Response.md => EnumClass.md} (84%) create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/EnumTest.md delete mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php delete mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php rename samples/client/petstore/php/SwaggerClient-php/lib/Tests/{InlineResponse200Test.php => EnumClassTest.php} (88%) create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumTestTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index a5cba5dcbb7..3afa7f22219 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-06T23:45:46.258+02:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -134,12 +134,6 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## api_key - -- **Type**: API key -- **API key parameter name**: api_key -- **Location**: HTTP header - ## petstore_auth - **Type**: OAuth @@ -149,6 +143,12 @@ Class | Method | HTTP request | Description - **write:pets**: modify pets in your account - **read:pets**: read your pets +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + ## Author diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Animal.md b/samples/client/petstore/php/SwaggerClient-php/docs/Animal.md index 948a992f502..c57fbe8ea4a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Animal.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Animal.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **class_name** | **string** | | +**color** | **string** | | [optional] [default to 'red'] [[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/200Response.md b/samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md similarity index 84% rename from samples/client/petstore/php/SwaggerClient-php/docs/200Response.md rename to samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md index 284a8795c61..67f017becd0 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/200Response.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/EnumClass.md @@ -1,9 +1,8 @@ -# 200Response +# EnumClass ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **int** | | [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/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/docs/InlineResponse200.md b/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md deleted file mode 100644 index 1c0b9237453..00000000000 --- a/samples/client/petstore/php/SwaggerClient-php/docs/InlineResponse200.md +++ /dev/null @@ -1,15 +0,0 @@ -# InlineResponse200 - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**tags** | [**\Swagger\Client\Model\Tag[]**](Tag.md) | | [optional] -**id** | **int** | | -**category** | **object** | | [optional] -**status** | **string** | pet status in the store | [optional] -**name** | **string** | | [optional] -**photo_urls** | **string[]** | | [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/Model/Animal.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php index 9e91fa7f02c..0dcd70201fe 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Animal Class Doc Comment * @@ -57,9 +58,10 @@ class Animal implements ArrayAccess * @var string[] */ static $swaggerTypes = array( - 'class_name' => 'string' + 'class_name' => 'string', + 'color' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -69,9 +71,10 @@ class Animal implements ArrayAccess * @var string[] */ static $attributeMap = array( - 'class_name' => 'className' + 'class_name' => 'className', + 'color' => 'color' ); - + static function attributeMap() { return self::$attributeMap; } @@ -81,9 +84,10 @@ class Animal implements ArrayAccess * @var string[] */ static $setters = array( - 'class_name' => 'setClassName' + 'class_name' => 'setClassName', + 'color' => 'setColor' ); - + static function setters() { return self::$setters; } @@ -93,7 +97,8 @@ class Animal implements ArrayAccess * @var string[] */ static $getters = array( - 'class_name' => 'getClassName' + 'class_name' => 'getClassName', + 'color' => 'getColor' ); static function getters() { @@ -108,13 +113,7 @@ class Animal implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['class_name'] - * @var string - */ - 'class_name' => null, - ); + protected $container = array(); /** * Constructor @@ -122,15 +121,14 @@ class Animal implements ArrayAccess */ public function __construct(array $data = null) { - + $this->container['class_name'] = isset($data['class_name']) ? $data['class_name'] : null; + $this->container['color'] = isset($data['color']) ? $data['color'] : 'red'; + // Initialize discriminator property with the model name. $discrimintor = array_search('className', self::$attributeMap); $this->container[$discrimintor] = static::$swaggerModelName; - - if ($data != null) { - $this->container['class_name'] = $data['class_name']; - } } + /** * Gets class_name * @return string @@ -151,6 +149,27 @@ class Animal implements ArrayAccess $this->container['class_name'] = $class_name; return $this; } + + /** + * Gets color + * @return string + */ + public function getColor() + { + return $this->container['color']; + } + + /** + * Sets color + * @param string $color + * @return $this + */ + public function setColor($color) + { + + $this->container['color'] = $color; + return $this; + } /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset 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..53a9fc2bdd3 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * AnimalFarm Class Doc Comment * @@ -59,7 +60,7 @@ class AnimalFarm implements ArrayAccess static $swaggerTypes = array( ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class AnimalFarm implements ArrayAccess static $attributeMap = array( ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class AnimalFarm implements ArrayAccess static $setters = array( ); - + static function setters() { return self::$setters; } @@ -116,11 +117,6 @@ class AnimalFarm implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - - } } /** * Returns true if offset exists. False otherwise. 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..4c438a46eb8 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * ApiResponse Class Doc Comment * @@ -61,7 +62,7 @@ class ApiResponse implements ArrayAccess 'type' => 'string', 'message' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -75,7 +76,7 @@ class ApiResponse implements ArrayAccess 'type' => 'type', 'message' => 'message' ); - + static function attributeMap() { return self::$attributeMap; } @@ -89,7 +90,7 @@ class ApiResponse implements ArrayAccess 'type' => 'setType', 'message' => 'setMessage' ); - + static function setters() { return self::$setters; } @@ -116,25 +117,7 @@ class ApiResponse implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['code'] - * @var int - */ - 'code' => null, - - /** - * $container['type'] - * @var string - */ - 'type' => null, - - /** - * $container['message'] - * @var string - */ - 'message' => null, - ); + protected $container = array(); /** * Constructor @@ -142,14 +125,11 @@ class ApiResponse implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['code'] = $data['code']; - $this->container['type'] = $data['type']; - $this->container['message'] = $data['message']; - } + $this->container['code'] = isset($data['code']) ? $data['code'] : null; + $this->container['type'] = isset($data['type']) ? $data['type'] : null; + $this->container['message'] = isset($data['message']) ? $data['message'] : null; } + /** * Gets code * @return int @@ -170,6 +150,7 @@ class ApiResponse implements ArrayAccess $this->container['code'] = $code; return $this; } + /** * Gets type * @return string @@ -190,6 +171,7 @@ class ApiResponse implements ArrayAccess $this->container['type'] = $type; return $this; } + /** * Gets message * @return string 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..3b3c5ea49c0 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Cat Class Doc Comment * @@ -59,7 +60,7 @@ class Cat extends Animal implements ArrayAccess static $swaggerTypes = array( 'declawed' => 'bool' ); - + static function swaggerTypes() { return self::$swaggerTypes + parent::swaggerTypes(); } @@ -71,7 +72,7 @@ class Cat extends Animal implements ArrayAccess static $attributeMap = array( 'declawed' => 'declawed' ); - + static function attributeMap() { return parent::attributeMap() + self::$attributeMap; } @@ -83,7 +84,7 @@ class Cat extends Animal implements ArrayAccess static $setters = array( 'declawed' => 'setDeclawed' ); - + static function setters() { return parent::setters() + self::$setters; } @@ -108,13 +109,7 @@ class Cat extends Animal implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['declawed'] - * @var bool - */ - 'declawed' => null, - ); + protected $container = array(); /** * Constructor @@ -123,11 +118,10 @@ class Cat extends Animal implements ArrayAccess public function __construct(array $data = null) { parent::__construct($data); - - if ($data != null) { - $this->container['declawed'] = $data['declawed']; - } + + $this->container['declawed'] = isset($data['declawed']) ? $data['declawed'] : null; } + /** * Gets declawed * @return bool 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..9b724ad1d2a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Category Class Doc Comment * @@ -60,7 +61,7 @@ class Category implements ArrayAccess 'id' => 'int', 'name' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -73,7 +74,7 @@ class Category implements ArrayAccess 'id' => 'id', 'name' => 'name' ); - + static function attributeMap() { return self::$attributeMap; } @@ -86,7 +87,7 @@ class Category implements ArrayAccess 'id' => 'setId', 'name' => 'setName' ); - + static function setters() { return self::$setters; } @@ -112,19 +113,7 @@ class Category implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['name'] - * @var string - */ - 'name' => null, - ); + protected $container = array(); /** * Constructor @@ -132,13 +121,10 @@ class Category implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['id'] = $data['id']; - $this->container['name'] = $data['name']; - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; } + /** * Gets id * @return int @@ -159,6 +145,7 @@ class Category implements ArrayAccess $this->container['id'] = $id; return $this; } + /** * Gets name * @return string 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..8ba1450116f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Dog Class Doc Comment * @@ -59,7 +60,7 @@ class Dog extends Animal implements ArrayAccess static $swaggerTypes = array( 'breed' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes + parent::swaggerTypes(); } @@ -71,7 +72,7 @@ class Dog extends Animal implements ArrayAccess static $attributeMap = array( 'breed' => 'breed' ); - + static function attributeMap() { return parent::attributeMap() + self::$attributeMap; } @@ -83,7 +84,7 @@ class Dog extends Animal implements ArrayAccess static $setters = array( 'breed' => 'setBreed' ); - + static function setters() { return parent::setters() + self::$setters; } @@ -108,13 +109,7 @@ class Dog extends Animal implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['breed'] - * @var string - */ - 'breed' => null, - ); + protected $container = array(); /** * Constructor @@ -123,11 +118,10 @@ class Dog extends Animal implements ArrayAccess public function __construct(array $data = null) { parent::__construct($data); - - if ($data != null) { - $this->container['breed'] = $data['breed']; - } + + $this->container['breed'] = isset($data['breed']) ? $data['breed'] : null; } + /** * Gets breed * @return string 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..abc2f8c998a --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php @@ -0,0 +1,178 @@ +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..e21f650072d --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php @@ -0,0 +1,300 @@ + '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(); + + /** + * Constructor + * @param mixed[] $data Associated array of property value initalizing the model + */ + public function __construct(array $data = null) + { + $this->container['enum_string'] = isset($data['enum_string']) ? $data['enum_string'] : null; + $this->container['enum_integer'] = isset($data['enum_integer']) ? $data['enum_integer'] : null; + $this->container['enum_number'] = isset($data['enum_number']) ? $data['enum_number'] : null; + } + + /** + * 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..3925c752372 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * FormatTest Class Doc Comment * @@ -71,7 +72,7 @@ class FormatTest implements ArrayAccess 'uuid' => 'string', 'password' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -95,7 +96,7 @@ class FormatTest implements ArrayAccess 'uuid' => 'uuid', 'password' => 'password' ); - + static function attributeMap() { return self::$attributeMap; } @@ -119,7 +120,7 @@ class FormatTest implements ArrayAccess 'uuid' => 'setUuid', 'password' => 'setPassword' ); - + static function setters() { return self::$setters; } @@ -156,85 +157,7 @@ class FormatTest implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['integer'] - * @var int - */ - 'integer' => null, - - /** - * $container['int32'] - * @var int - */ - 'int32' => null, - - /** - * $container['int64'] - * @var int - */ - 'int64' => null, - - /** - * $container['number'] - * @var float - */ - 'number' => null, - - /** - * $container['float'] - * @var float - */ - 'float' => null, - - /** - * $container['double'] - * @var double - */ - 'double' => null, - - /** - * $container['string'] - * @var string - */ - 'string' => null, - - /** - * $container['byte'] - * @var string - */ - 'byte' => null, - - /** - * $container['binary'] - * @var string - */ - 'binary' => null, - - /** - * $container['date'] - * @var \DateTime - */ - 'date' => null, - - /** - * $container['date_time'] - * @var \DateTime - */ - 'date_time' => null, - - /** - * $container['uuid'] - * @var string - */ - 'uuid' => null, - - /** - * $container['password'] - * @var string - */ - 'password' => null, - ); + protected $container = array(); /** * Constructor @@ -242,24 +165,21 @@ class FormatTest implements ArrayAccess */ 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']; - } + $this->container['integer'] = isset($data['integer']) ? $data['integer'] : null; + $this->container['int32'] = isset($data['int32']) ? $data['int32'] : null; + $this->container['int64'] = isset($data['int64']) ? $data['int64'] : null; + $this->container['number'] = isset($data['number']) ? $data['number'] : null; + $this->container['float'] = isset($data['float']) ? $data['float'] : null; + $this->container['double'] = isset($data['double']) ? $data['double'] : null; + $this->container['string'] = isset($data['string']) ? $data['string'] : null; + $this->container['byte'] = isset($data['byte']) ? $data['byte'] : null; + $this->container['binary'] = isset($data['binary']) ? $data['binary'] : null; + $this->container['date'] = isset($data['date']) ? $data['date'] : null; + $this->container['date_time'] = isset($data['date_time']) ? $data['date_time'] : null; + $this->container['uuid'] = isset($data['uuid']) ? $data['uuid'] : null; + $this->container['password'] = isset($data['password']) ? $data['password'] : null; } + /** * Gets integer * @return int @@ -280,6 +200,7 @@ class FormatTest implements ArrayAccess $this->container['integer'] = $integer; return $this; } + /** * Gets int32 * @return int @@ -300,6 +221,7 @@ class FormatTest implements ArrayAccess $this->container['int32'] = $int32; return $this; } + /** * Gets int64 * @return int @@ -320,6 +242,7 @@ class FormatTest implements ArrayAccess $this->container['int64'] = $int64; return $this; } + /** * Gets number * @return float @@ -340,6 +263,7 @@ class FormatTest implements ArrayAccess $this->container['number'] = $number; return $this; } + /** * Gets float * @return float @@ -360,6 +284,7 @@ class FormatTest implements ArrayAccess $this->container['float'] = $float; return $this; } + /** * Gets double * @return double @@ -380,6 +305,7 @@ class FormatTest implements ArrayAccess $this->container['double'] = $double; return $this; } + /** * Gets string * @return string @@ -400,6 +326,7 @@ class FormatTest implements ArrayAccess $this->container['string'] = $string; return $this; } + /** * Gets byte * @return string @@ -420,6 +347,7 @@ class FormatTest implements ArrayAccess $this->container['byte'] = $byte; return $this; } + /** * Gets binary * @return string @@ -440,6 +368,7 @@ class FormatTest implements ArrayAccess $this->container['binary'] = $binary; return $this; } + /** * Gets date * @return \DateTime @@ -460,6 +389,7 @@ class FormatTest implements ArrayAccess $this->container['date'] = $date; return $this; } + /** * Gets date_time * @return \DateTime @@ -480,6 +410,7 @@ class FormatTest implements ArrayAccess $this->container['date_time'] = $date_time; return $this; } + /** * Gets uuid * @return string @@ -500,6 +431,7 @@ class FormatTest implements ArrayAccess $this->container['uuid'] = $uuid; return $this; } + /** * Gets password * @return string diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php deleted file mode 100644 index d66a078a4e0..00000000000 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php +++ /dev/null @@ -1,375 +0,0 @@ - '\Swagger\Client\Model\Tag[]', - 'id' => 'int', - 'category' => 'object', - 'status' => 'string', - 'name' => 'string', - 'photo_urls' => 'string[]' - ); - - 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( - 'tags' => 'tags', - 'id' => 'id', - 'category' => 'category', - 'status' => 'status', - 'name' => 'name', - 'photo_urls' => 'photoUrls' - ); - - static function attributeMap() { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * @var string[] - */ - static $setters = array( - 'tags' => 'setTags', - 'id' => 'setId', - 'category' => 'setCategory', - 'status' => 'setStatus', - 'name' => 'setName', - 'photo_urls' => 'setPhotoUrls' - ); - - static function setters() { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * @var string[] - */ - static $getters = array( - 'tags' => 'getTags', - 'id' => 'getId', - 'category' => 'getCategory', - 'status' => 'getStatus', - 'name' => 'getName', - 'photo_urls' => 'getPhotoUrls' - ); - - static function getters() { - return self::$getters; - } - - const STATUS_AVAILABLE = 'available'; - const STATUS_PENDING = 'pending'; - const STATUS_SOLD = 'sold'; - - - - /** - * Gets allowable values of the enum - * @return string[] - */ - public function getStatusAllowableValues() { - return [ - self::STATUS_AVAILABLE, - self::STATUS_PENDING, - self::STATUS_SOLD, - ]; - } - - - - /** - * $tags - * @var \Swagger\Client\Model\Tag[] - */ - protected $tags; - - /** - * $id - * @var int - */ - protected $id; - - /** - * $category - * @var object - */ - protected $category; - - /** - * $status pet status in the store - * @var string - */ - protected $status; - - /** - * $name - * @var string - */ - protected $name; - - /** - * $photo_urls - * @var string[] - */ - protected $photo_urls; - - - /** - * Constructor - * @param mixed[] $data Associated array of property value initalizing the model - */ - public function __construct(array $data = null) - { - - if ($data != null) { - $this->tags = $data["tags"]; - $this->id = $data["id"]; - $this->category = $data["category"]; - $this->status = $data["status"]; - $this->name = $data["name"]; - $this->photo_urls = $data["photo_urls"]; - } - } - - /** - * Gets tags. - * @return \Swagger\Client\Model\Tag[] - */ - public function getTags() - { - return $this->tags; - } - - /** - * Sets tags. - * @param \Swagger\Client\Model\Tag[] $tags - * @return $this - */ - public function setTags($tags) - { - - $this->tags = $tags; - return $this; - } - - /** - * Gets id. - * @return int - */ - public function getId() - { - return $this->id; - } - - /** - * Sets id. - * @param int $id - * @return $this - */ - public function setId($id) - { - - $this->id = $id; - return $this; - } - - /** - * Gets category. - * @return object - */ - public function getCategory() - { - return $this->category; - } - - /** - * Sets category. - * @param object $category - * @return $this - */ - public function setCategory($category) - { - - $this->category = $category; - return $this; - } - - /** - * Gets status. - * @return string - */ - public function getStatus() - { - return $this->status; - } - - /** - * Sets status. - * @param string $status pet status in the store - * @return $this - */ - public function setStatus($status) - { - $allowed_values = array("available", "pending", "sold"); - 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; - } - - /** - * Gets name. - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Sets name. - * @param string $name - * @return $this - */ - public function setName($name) - { - - $this->name = $name; - return $this; - } - - /** - * Gets photo_urls. - * @return string[] - */ - public function getPhotoUrls() - { - return $this->photo_urls; - } - - /** - * Sets photo_urls. - * @param string[] $photo_urls - * @return $this - */ - public function setPhotoUrls($photo_urls) - { - - $this->photo_urls = $photo_urls; - return $this; - } - - /** - * Returns true if offset exists. False otherwise. - * @param integer $offset Offset - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->$offset); - } - - /** - * Gets offset. - * @param integer $offset Offset - * @return mixed - */ - public function offsetGet($offset) - { - return $this->$offset; - } - - /** - * Sets value based on offset. - * @param integer $offset Offset - * @param mixed $value Value to be set - * @return void - */ - public function offsetSet($offset, $value) - { - $this->$offset = $value; - } - - /** - * Unsets offset. - * @param integer $offset Offset - * @return void - */ - public function offsetUnset($offset) - { - unset($this->$offset); - } - - /** - * Gets the string presentation of the object. - * @return string - */ - public function __toString() - { - if (defined('JSON_PRETTY_PRINT')) { - return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); - } else { - return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($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..0ff50e3263a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Model200Response Class Doc Comment * @@ -59,7 +60,7 @@ class Model200Response implements ArrayAccess static $swaggerTypes = array( 'name' => 'int' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class Model200Response implements ArrayAccess static $attributeMap = array( 'name' => 'name' ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class Model200Response implements ArrayAccess static $setters = array( 'name' => 'setName' ); - + static function setters() { return self::$setters; } @@ -108,13 +109,7 @@ class Model200Response implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['name'] - * @var int - */ - 'name' => null, - ); + protected $container = array(); /** * Constructor @@ -122,12 +117,9 @@ class Model200Response implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['name'] = $data['name']; - } + $this->container['name'] = isset($data['name']) ? $data['name'] : null; } + /** * Gets name * @return int 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..e4c3524d882 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * ModelReturn Class Doc Comment * @@ -59,7 +60,7 @@ class ModelReturn implements ArrayAccess static $swaggerTypes = array( 'return' => 'int' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class ModelReturn implements ArrayAccess static $attributeMap = array( 'return' => 'return' ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class ModelReturn implements ArrayAccess static $setters = array( 'return' => 'setReturn' ); - + static function setters() { return self::$setters; } @@ -108,13 +109,7 @@ class ModelReturn implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['return'] - * @var int - */ - 'return' => null, - ); + protected $container = array(); /** * Constructor @@ -122,12 +117,9 @@ class ModelReturn implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['return'] = $data['return']; - } + $this->container['return'] = isset($data['return']) ? $data['return'] : null; } + /** * Gets return * @return int 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..05c6a65d1a6 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Name Class Doc Comment * @@ -61,7 +62,7 @@ class Name implements ArrayAccess 'snake_case' => 'int', 'property' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -75,7 +76,7 @@ class Name implements ArrayAccess 'snake_case' => 'snake_case', 'property' => 'property' ); - + static function attributeMap() { return self::$attributeMap; } @@ -89,7 +90,7 @@ class Name implements ArrayAccess 'snake_case' => 'setSnakeCase', 'property' => 'setProperty' ); - + static function setters() { return self::$setters; } @@ -116,25 +117,7 @@ class Name implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['name'] - * @var int - */ - 'name' => null, - - /** - * $container['snake_case'] - * @var int - */ - 'snake_case' => null, - - /** - * $container['property'] - * @var string - */ - 'property' => null, - ); + protected $container = array(); /** * Constructor @@ -142,14 +125,11 @@ class Name implements ArrayAccess */ 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']; - } + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['snake_case'] = isset($data['snake_case']) ? $data['snake_case'] : null; + $this->container['property'] = isset($data['property']) ? $data['property'] : null; } + /** * Gets name * @return int @@ -170,6 +150,7 @@ class Name implements ArrayAccess $this->container['name'] = $name; return $this; } + /** * Gets snake_case * @return int @@ -190,6 +171,7 @@ class Name implements ArrayAccess $this->container['snake_case'] = $snake_case; return $this; } + /** * Gets property * @return string 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..b0b7dcba6fc 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Order Class Doc Comment * @@ -64,7 +65,7 @@ class Order implements ArrayAccess 'status' => 'string', 'complete' => 'bool' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -81,7 +82,7 @@ class Order implements ArrayAccess 'status' => 'status', 'complete' => 'complete' ); - + static function attributeMap() { return self::$attributeMap; } @@ -98,7 +99,7 @@ class Order implements ArrayAccess 'status' => 'setStatus', 'complete' => 'setComplete' ); - + static function setters() { return self::$setters; } @@ -143,43 +144,7 @@ class Order implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['pet_id'] - * @var int - */ - 'pet_id' => null, - - /** - * $container['quantity'] - * @var int - */ - 'quantity' => null, - - /** - * $container['ship_date'] - * @var \DateTime - */ - 'ship_date' => null, - - /** - * $container['status'] Order Status - * @var string - */ - 'status' => null, - - /** - * $container['complete'] - * @var bool - */ - 'complete' => false, - ); + protected $container = array(); /** * Constructor @@ -187,17 +152,14 @@ class Order implements ArrayAccess */ 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']; - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['pet_id'] = isset($data['pet_id']) ? $data['pet_id'] : null; + $this->container['quantity'] = isset($data['quantity']) ? $data['quantity'] : null; + $this->container['ship_date'] = isset($data['ship_date']) ? $data['ship_date'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->container['complete'] = isset($data['complete']) ? $data['complete'] : false; } + /** * Gets id * @return int @@ -218,6 +180,7 @@ class Order implements ArrayAccess $this->container['id'] = $id; return $this; } + /** * Gets pet_id * @return int @@ -238,6 +201,7 @@ class Order implements ArrayAccess $this->container['pet_id'] = $pet_id; return $this; } + /** * Gets quantity * @return int @@ -258,6 +222,7 @@ class Order implements ArrayAccess $this->container['quantity'] = $quantity; return $this; } + /** * Gets ship_date * @return \DateTime @@ -278,6 +243,7 @@ class Order implements ArrayAccess $this->container['ship_date'] = $ship_date; return $this; } + /** * Gets status * @return string @@ -301,6 +267,7 @@ class Order implements ArrayAccess $this->container['status'] = $status; return $this; } + /** * Gets complete * @return bool 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..699e602459c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Pet Class Doc Comment * @@ -64,7 +65,7 @@ class Pet implements ArrayAccess 'tags' => '\Swagger\Client\Model\Tag[]', 'status' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -81,7 +82,7 @@ class Pet implements ArrayAccess 'tags' => 'tags', 'status' => 'status' ); - + static function attributeMap() { return self::$attributeMap; } @@ -98,7 +99,7 @@ class Pet implements ArrayAccess 'tags' => 'setTags', 'status' => 'setStatus' ); - + static function setters() { return self::$setters; } @@ -143,43 +144,7 @@ class Pet implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['category'] - * @var \Swagger\Client\Model\Category - */ - 'category' => null, - - /** - * $container['name'] - * @var string - */ - 'name' => null, - - /** - * $container['photo_urls'] - * @var string[] - */ - 'photo_urls' => null, - - /** - * $container['tags'] - * @var \Swagger\Client\Model\Tag[] - */ - 'tags' => null, - - /** - * $container['status'] pet status in the store - * @var string - */ - 'status' => null, - ); + protected $container = array(); /** * Constructor @@ -187,17 +152,14 @@ class Pet implements ArrayAccess */ 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']; - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['category'] = isset($data['category']) ? $data['category'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['photo_urls'] = isset($data['photo_urls']) ? $data['photo_urls'] : null; + $this->container['tags'] = isset($data['tags']) ? $data['tags'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; } + /** * Gets id * @return int @@ -218,6 +180,7 @@ class Pet implements ArrayAccess $this->container['id'] = $id; return $this; } + /** * Gets category * @return \Swagger\Client\Model\Category @@ -238,6 +201,7 @@ class Pet implements ArrayAccess $this->container['category'] = $category; return $this; } + /** * Gets name * @return string @@ -258,6 +222,7 @@ class Pet implements ArrayAccess $this->container['name'] = $name; return $this; } + /** * Gets photo_urls * @return string[] @@ -278,6 +243,7 @@ class Pet implements ArrayAccess $this->container['photo_urls'] = $photo_urls; return $this; } + /** * Gets tags * @return \Swagger\Client\Model\Tag[] @@ -298,6 +264,7 @@ class Pet implements ArrayAccess $this->container['tags'] = $tags; return $this; } + /** * Gets status * @return string 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..2a84ec5e431 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * SpecialModelName Class Doc Comment * @@ -59,7 +60,7 @@ class SpecialModelName implements ArrayAccess static $swaggerTypes = array( 'special_property_name' => 'int' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class SpecialModelName implements ArrayAccess static $attributeMap = array( 'special_property_name' => '$special[property.name]' ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class SpecialModelName implements ArrayAccess static $setters = array( 'special_property_name' => 'setSpecialPropertyName' ); - + static function setters() { return self::$setters; } @@ -108,13 +109,7 @@ class SpecialModelName implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['special_property_name'] - * @var int - */ - 'special_property_name' => null, - ); + protected $container = array(); /** * Constructor @@ -122,12 +117,9 @@ class SpecialModelName implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['special_property_name'] = $data['special_property_name']; - } + $this->container['special_property_name'] = isset($data['special_property_name']) ? $data['special_property_name'] : null; } + /** * Gets special_property_name * @return int 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..c943bbf46be 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Tag Class Doc Comment * @@ -60,7 +61,7 @@ class Tag implements ArrayAccess 'id' => 'int', 'name' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -73,7 +74,7 @@ class Tag implements ArrayAccess 'id' => 'id', 'name' => 'name' ); - + static function attributeMap() { return self::$attributeMap; } @@ -86,7 +87,7 @@ class Tag implements ArrayAccess 'id' => 'setId', 'name' => 'setName' ); - + static function setters() { return self::$setters; } @@ -112,19 +113,7 @@ class Tag implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['name'] - * @var string - */ - 'name' => null, - ); + protected $container = array(); /** * Constructor @@ -132,13 +121,10 @@ class Tag implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - $this->container['id'] = $data['id']; - $this->container['name'] = $data['name']; - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; } + /** * Gets id * @return int @@ -159,6 +145,7 @@ class Tag implements ArrayAccess $this->container['id'] = $id; return $this; } + /** * Gets name * @return string 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..b622b735b83 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * User Class Doc Comment * @@ -66,7 +67,7 @@ class User implements ArrayAccess 'phone' => 'string', 'user_status' => 'int' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -85,7 +86,7 @@ class User implements ArrayAccess 'phone' => 'phone', 'user_status' => 'userStatus' ); - + static function attributeMap() { return self::$attributeMap; } @@ -104,7 +105,7 @@ class User implements ArrayAccess 'phone' => 'setPhone', 'user_status' => 'setUserStatus' ); - + static function setters() { return self::$setters; } @@ -136,55 +137,7 @@ class User implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['username'] - * @var string - */ - 'username' => null, - - /** - * $container['first_name'] - * @var string - */ - 'first_name' => null, - - /** - * $container['last_name'] - * @var string - */ - 'last_name' => null, - - /** - * $container['email'] - * @var string - */ - 'email' => null, - - /** - * $container['password'] - * @var string - */ - 'password' => null, - - /** - * $container['phone'] - * @var string - */ - 'phone' => null, - - /** - * $container['user_status'] User Status - * @var int - */ - 'user_status' => null, - ); + protected $container = array(); /** * Constructor @@ -192,19 +145,16 @@ class User implements ArrayAccess */ 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']; - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['username'] = isset($data['username']) ? $data['username'] : null; + $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; + $this->container['last_name'] = isset($data['last_name']) ? $data['last_name'] : null; + $this->container['email'] = isset($data['email']) ? $data['email'] : null; + $this->container['password'] = isset($data['password']) ? $data['password'] : null; + $this->container['phone'] = isset($data['phone']) ? $data['phone'] : null; + $this->container['user_status'] = isset($data['user_status']) ? $data['user_status'] : null; } + /** * Gets id * @return int @@ -225,6 +175,7 @@ class User implements ArrayAccess $this->container['id'] = $id; return $this; } + /** * Gets username * @return string @@ -245,6 +196,7 @@ class User implements ArrayAccess $this->container['username'] = $username; return $this; } + /** * Gets first_name * @return string @@ -265,6 +217,7 @@ class User implements ArrayAccess $this->container['first_name'] = $first_name; return $this; } + /** * Gets last_name * @return string @@ -285,6 +238,7 @@ class User implements ArrayAccess $this->container['last_name'] = $last_name; return $this; } + /** * Gets email * @return string @@ -305,6 +259,7 @@ class User implements ArrayAccess $this->container['email'] = $email; return $this; } + /** * Gets password * @return string @@ -325,6 +280,7 @@ class User implements ArrayAccess $this->container['password'] = $password; return $this; } + /** * Gets phone * @return string @@ -345,6 +301,7 @@ class User implements ArrayAccess $this->container['phone'] = $phone; return $this; } + /** * Gets user_status * @return int diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php index 3adaa899f5f..ac63c18fbd5 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php @@ -256,7 +256,7 @@ class ObjectSerializer } else { return null; } - } elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) { + } elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) { settype($data, $class); return $data; } elseif ($class === '\SplFileObject') { diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/InlineResponse200Test.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php similarity index 88% rename from samples/client/petstore/php/SwaggerClient-php/lib/Tests/InlineResponse200Test.php rename to samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php index 1bd1c822700..4d901dfd1c9 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/InlineResponse200Test.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/EnumClassTest.php @@ -1,6 +1,6 @@ Date: Tue, 10 May 2016 00:39:55 +0800 Subject: [PATCH 3/3] update php petstore sample --- .../petstore/php/SwaggerClient-php/README.md | 2 +- .../SwaggerClient-php/lib/Model/Animal.php | 59 ++++--- .../lib/Model/AnimalFarm.php | 11 +- .../lib/Model/ApiResponse.php | 46 ++---- .../php/SwaggerClient-php/lib/Model/Cat.php | 24 +-- .../SwaggerClient-php/lib/Model/Category.php | 35 +--- .../php/SwaggerClient-php/lib/Model/Dog.php | 24 +-- .../SwaggerClient-php/lib/Model/EnumClass.php | 11 +- .../SwaggerClient-php/lib/Model/EnumTest.php | 46 ++---- .../lib/Model/FormatTest.php | 156 ++++-------------- .../lib/Model/Model200Response.php | 24 +-- .../lib/Model/ModelReturn.php | 24 +-- .../php/SwaggerClient-php/lib/Model/Name.php | 46 ++---- .../php/SwaggerClient-php/lib/Model/Order.php | 79 ++------- .../php/SwaggerClient-php/lib/Model/Pet.php | 79 ++------- .../lib/Model/SpecialModelName.php | 24 +-- .../php/SwaggerClient-php/lib/Model/Tag.php | 35 +--- .../php/SwaggerClient-php/lib/Model/User.php | 101 +++--------- .../lib/ObjectSerializer.php | 2 +- 19 files changed, 222 insertions(+), 606 deletions(-) diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index d781d4d1d31..bf4afd1a8f1 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-09T16:31:19.614+08:00 +- Build date: 2016-05-10T00:30:19.190+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements 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 c87fe976354..9120535bf5a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Animal.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Animal Class Doc Comment * @@ -57,9 +58,10 @@ class Animal implements ArrayAccess * @var string[] */ static $swaggerTypes = array( - 'class_name' => 'string' + 'class_name' => 'string', + 'color' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -69,9 +71,10 @@ class Animal implements ArrayAccess * @var string[] */ static $attributeMap = array( - 'class_name' => 'className' + 'class_name' => 'className', + 'color' => 'color' ); - + static function attributeMap() { return self::$attributeMap; } @@ -81,9 +84,10 @@ class Animal implements ArrayAccess * @var string[] */ static $setters = array( - 'class_name' => 'setClassName' + 'class_name' => 'setClassName', + 'color' => 'setColor' ); - + static function setters() { return self::$setters; } @@ -93,7 +97,8 @@ class Animal implements ArrayAccess * @var string[] */ static $getters = array( - 'class_name' => 'getClassName' + 'class_name' => 'getClassName', + 'color' => 'getColor' ); static function getters() { @@ -108,13 +113,7 @@ class Animal implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['class_name'] - * @var string - */ - 'class_name' => null, - ); + protected $container = array(); /** * Constructor @@ -122,16 +121,12 @@ class Animal implements ArrayAccess */ public function __construct(array $data = null) { - + $this->container['class_name'] = isset($data['class_name']) ? $data['class_name'] : null; + $this->container['color'] = isset($data['color']) ? $data['color'] : 'red'; + // Initialize discriminator property with the model name. $discrimintor = array_search('className', self::$attributeMap); $this->container[$discrimintor] = static::$swaggerModelName; - - if ($data != null) { - if (isset($data["class_name"])) { - $this->container['class_name'] = $data["class_name"]; - } - } } /** @@ -162,6 +157,7 @@ class Animal implements ArrayAccess return true; } + /** * Gets class_name * @return string @@ -182,6 +178,27 @@ class Animal implements ArrayAccess return $this; } + + /** + * Gets color + * @return string + */ + public function getColor() + { + return $this->container['color']; + } + + /** + * Sets color + * @param string $color + * @return $this + */ + public function setColor($color) + { + $this->container['color'] = $color; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset 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 afd16e0a5c8..2ff9da6a4ea 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/AnimalFarm.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * AnimalFarm Class Doc Comment * @@ -59,7 +60,7 @@ class AnimalFarm implements ArrayAccess static $swaggerTypes = array( ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class AnimalFarm implements ArrayAccess static $attributeMap = array( ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class AnimalFarm implements ArrayAccess static $setters = array( ); - + static function setters() { return self::$setters; } @@ -116,10 +117,6 @@ class AnimalFarm implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - } } /** 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 655cb7e4b2c..8894f835aea 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ApiResponse.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * ApiResponse Class Doc Comment * @@ -61,7 +62,7 @@ class ApiResponse implements ArrayAccess 'type' => 'string', 'message' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -75,7 +76,7 @@ class ApiResponse implements ArrayAccess 'type' => 'type', 'message' => 'message' ); - + static function attributeMap() { return self::$attributeMap; } @@ -89,7 +90,7 @@ class ApiResponse implements ArrayAccess 'type' => 'setType', 'message' => 'setMessage' ); - + static function setters() { return self::$setters; } @@ -116,25 +117,7 @@ class ApiResponse implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['code'] - * @var int - */ - 'code' => null, - - /** - * $container['type'] - * @var string - */ - 'type' => null, - - /** - * $container['message'] - * @var string - */ - 'message' => null, - ); + protected $container = array(); /** * Constructor @@ -142,19 +125,9 @@ class ApiResponse implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - 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"]; - } - } + $this->container['code'] = isset($data['code']) ? $data['code'] : null; + $this->container['type'] = isset($data['type']) ? $data['type'] : null; + $this->container['message'] = isset($data['message']) ? $data['message'] : null; } /** @@ -179,6 +152,7 @@ class ApiResponse implements ArrayAccess return true; } + /** * Gets code * @return int @@ -199,6 +173,7 @@ class ApiResponse implements ArrayAccess return $this; } + /** * Gets type * @return string @@ -219,6 +194,7 @@ class ApiResponse implements ArrayAccess return $this; } + /** * Gets message * @return string 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 31b9f153cd4..393f89e5b0f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Cat.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Cat Class Doc Comment * @@ -59,7 +60,7 @@ class Cat extends Animal implements ArrayAccess static $swaggerTypes = array( 'declawed' => 'bool' ); - + static function swaggerTypes() { return self::$swaggerTypes + parent::swaggerTypes(); } @@ -71,7 +72,7 @@ class Cat extends Animal implements ArrayAccess static $attributeMap = array( 'declawed' => 'declawed' ); - + static function attributeMap() { return parent::attributeMap() + self::$attributeMap; } @@ -83,7 +84,7 @@ class Cat extends Animal implements ArrayAccess static $setters = array( 'declawed' => 'setDeclawed' ); - + static function setters() { return parent::setters() + self::$setters; } @@ -108,13 +109,7 @@ class Cat extends Animal implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['declawed'] - * @var bool - */ - 'declawed' => null, - ); + protected $container = array(); /** * Constructor @@ -123,12 +118,8 @@ class Cat extends Animal implements ArrayAccess public function __construct(array $data = null) { parent::__construct($data); - - if ($data != null) { - if (isset($data["declawed"])) { - $this->container['declawed'] = $data["declawed"]; - } - } + + $this->container['declawed'] = isset($data['declawed']) ? $data['declawed'] : null; } /** @@ -153,6 +144,7 @@ class Cat extends Animal implements ArrayAccess return true; } + /** * Gets declawed * @return bool 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 f186c7b740c..1c1a2340378 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Category.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Category Class Doc Comment * @@ -60,7 +61,7 @@ class Category implements ArrayAccess 'id' => 'int', 'name' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -73,7 +74,7 @@ class Category implements ArrayAccess 'id' => 'id', 'name' => 'name' ); - + static function attributeMap() { return self::$attributeMap; } @@ -86,7 +87,7 @@ class Category implements ArrayAccess 'id' => 'setId', 'name' => 'setName' ); - + static function setters() { return self::$setters; } @@ -112,19 +113,7 @@ class Category implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['name'] - * @var string - */ - 'name' => null, - ); + protected $container = array(); /** * Constructor @@ -132,16 +121,8 @@ class Category implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["id"])) { - $this->container['id'] = $data["id"]; - } - if (isset($data["name"])) { - $this->container['name'] = $data["name"]; - } - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; } /** @@ -166,6 +147,7 @@ class Category implements ArrayAccess return true; } + /** * Gets id * @return int @@ -186,6 +168,7 @@ class Category implements ArrayAccess return $this; } + /** * Gets name * @return string 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 d14fa50ca19..b79e76a4187 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Dog.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Dog Class Doc Comment * @@ -59,7 +60,7 @@ class Dog extends Animal implements ArrayAccess static $swaggerTypes = array( 'breed' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes + parent::swaggerTypes(); } @@ -71,7 +72,7 @@ class Dog extends Animal implements ArrayAccess static $attributeMap = array( 'breed' => 'breed' ); - + static function attributeMap() { return parent::attributeMap() + self::$attributeMap; } @@ -83,7 +84,7 @@ class Dog extends Animal implements ArrayAccess static $setters = array( 'breed' => 'setBreed' ); - + static function setters() { return parent::setters() + self::$setters; } @@ -108,13 +109,7 @@ class Dog extends Animal implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['breed'] - * @var string - */ - 'breed' => null, - ); + protected $container = array(); /** * Constructor @@ -123,12 +118,8 @@ class Dog extends Animal implements ArrayAccess public function __construct(array $data = null) { parent::__construct($data); - - if ($data != null) { - if (isset($data["breed"])) { - $this->container['breed'] = $data["breed"]; - } - } + + $this->container['breed'] = isset($data['breed']) ? $data['breed'] : null; } /** @@ -153,6 +144,7 @@ class Dog extends Animal implements ArrayAccess return true; } + /** * Gets breed * @return string diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php index f7d1457c30f..2b6d36c9b66 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumClass.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * EnumClass Class Doc Comment * @@ -59,7 +60,7 @@ class EnumClass implements ArrayAccess static $swaggerTypes = array( ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class EnumClass implements ArrayAccess static $attributeMap = array( ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class EnumClass implements ArrayAccess static $setters = array( ); - + static function setters() { return self::$setters; } @@ -116,10 +117,6 @@ class EnumClass implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - } } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php index 70e5e5ad961..6e10f45dd8f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/EnumTest.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * EnumTest Class Doc Comment * @@ -61,7 +62,7 @@ class EnumTest implements ArrayAccess 'enum_integer' => 'int', 'enum_number' => 'double' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -75,7 +76,7 @@ class EnumTest implements ArrayAccess 'enum_integer' => 'enum_integer', 'enum_number' => 'enum_number' ); - + static function attributeMap() { return self::$attributeMap; } @@ -89,7 +90,7 @@ class EnumTest implements ArrayAccess 'enum_integer' => 'setEnumInteger', 'enum_number' => 'setEnumNumber' ); - + static function setters() { return self::$setters; } @@ -155,25 +156,7 @@ class EnumTest implements ArrayAccess * 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, - ); + protected $container = array(); /** * Constructor @@ -181,19 +164,9 @@ class EnumTest implements ArrayAccess */ 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"]; - } - } + $this->container['enum_string'] = isset($data['enum_string']) ? $data['enum_string'] : null; + $this->container['enum_integer'] = isset($data['enum_integer']) ? $data['enum_integer'] : null; + $this->container['enum_number'] = isset($data['enum_number']) ? $data['enum_number'] : null; } /** @@ -242,6 +215,7 @@ class EnumTest implements ArrayAccess return true; } + /** * Gets enum_string * @return string @@ -266,6 +240,7 @@ class EnumTest implements ArrayAccess return $this; } + /** * Gets enum_integer * @return int @@ -290,6 +265,7 @@ class EnumTest implements ArrayAccess return $this; } + /** * Gets enum_number * @return double 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 322d7623bf1..bf674b05102 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * FormatTest Class Doc Comment * @@ -71,7 +72,7 @@ class FormatTest implements ArrayAccess 'uuid' => 'string', 'password' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -95,7 +96,7 @@ class FormatTest implements ArrayAccess 'uuid' => 'uuid', 'password' => 'password' ); - + static function attributeMap() { return self::$attributeMap; } @@ -119,7 +120,7 @@ class FormatTest implements ArrayAccess 'uuid' => 'setUuid', 'password' => 'setPassword' ); - + static function setters() { return self::$setters; } @@ -156,85 +157,7 @@ class FormatTest implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['integer'] - * @var int - */ - 'integer' => null, - - /** - * $container['int32'] - * @var int - */ - 'int32' => null, - - /** - * $container['int64'] - * @var int - */ - 'int64' => null, - - /** - * $container['number'] - * @var float - */ - 'number' => null, - - /** - * $container['float'] - * @var float - */ - 'float' => null, - - /** - * $container['double'] - * @var double - */ - 'double' => null, - - /** - * $container['string'] - * @var string - */ - 'string' => null, - - /** - * $container['byte'] - * @var string - */ - 'byte' => null, - - /** - * $container['binary'] - * @var string - */ - 'binary' => null, - - /** - * $container['date'] - * @var \DateTime - */ - 'date' => null, - - /** - * $container['date_time'] - * @var \DateTime - */ - 'date_time' => null, - - /** - * $container['uuid'] - * @var string - */ - 'uuid' => null, - - /** - * $container['password'] - * @var string - */ - 'password' => null, - ); + protected $container = array(); /** * Constructor @@ -242,49 +165,19 @@ class FormatTest implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - 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"]; - } - } + $this->container['integer'] = isset($data['integer']) ? $data['integer'] : null; + $this->container['int32'] = isset($data['int32']) ? $data['int32'] : null; + $this->container['int64'] = isset($data['int64']) ? $data['int64'] : null; + $this->container['number'] = isset($data['number']) ? $data['number'] : null; + $this->container['float'] = isset($data['float']) ? $data['float'] : null; + $this->container['double'] = isset($data['double']) ? $data['double'] : null; + $this->container['string'] = isset($data['string']) ? $data['string'] : null; + $this->container['byte'] = isset($data['byte']) ? $data['byte'] : null; + $this->container['binary'] = isset($data['binary']) ? $data['binary'] : null; + $this->container['date'] = isset($data['date']) ? $data['date'] : null; + $this->container['date_time'] = isset($data['date_time']) ? $data['date_time'] : null; + $this->container['uuid'] = isset($data['uuid']) ? $data['uuid'] : null; + $this->container['password'] = isset($data['password']) ? $data['password'] : null; } /** @@ -411,6 +304,7 @@ class FormatTest implements ArrayAccess return true; } + /** * Gets integer * @return int @@ -438,6 +332,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets int32 * @return int @@ -465,6 +360,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets int64 * @return int @@ -485,6 +381,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets number * @return float @@ -512,6 +409,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets float * @return float @@ -539,6 +437,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets double * @return double @@ -566,6 +465,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets string * @return string @@ -590,6 +490,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets byte * @return string @@ -610,6 +511,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets binary * @return string @@ -630,6 +532,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets date * @return \DateTime @@ -650,6 +553,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets date_time * @return \DateTime @@ -670,6 +574,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets uuid * @return string @@ -690,6 +595,7 @@ class FormatTest implements ArrayAccess return $this; } + /** * Gets password * @return string 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 07dcae58bfa..68eae680dc6 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Model200Response.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Model200Response Class Doc Comment * @@ -59,7 +60,7 @@ class Model200Response implements ArrayAccess static $swaggerTypes = array( 'name' => 'int' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class Model200Response implements ArrayAccess static $attributeMap = array( 'name' => 'name' ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class Model200Response implements ArrayAccess static $setters = array( 'name' => 'setName' ); - + static function setters() { return self::$setters; } @@ -108,13 +109,7 @@ class Model200Response implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['name'] - * @var int - */ - 'name' => null, - ); + protected $container = array(); /** * Constructor @@ -122,13 +117,7 @@ class Model200Response implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["name"])) { - $this->container['name'] = $data["name"]; - } - } + $this->container['name'] = isset($data['name']) ? $data['name'] : null; } /** @@ -153,6 +142,7 @@ class Model200Response implements ArrayAccess return true; } + /** * Gets name * @return int 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 78f2e6dfe99..7dce6f0029d 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/ModelReturn.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * ModelReturn Class Doc Comment * @@ -59,7 +60,7 @@ class ModelReturn implements ArrayAccess static $swaggerTypes = array( 'return' => 'int' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class ModelReturn implements ArrayAccess static $attributeMap = array( 'return' => 'return' ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class ModelReturn implements ArrayAccess static $setters = array( 'return' => 'setReturn' ); - + static function setters() { return self::$setters; } @@ -108,13 +109,7 @@ class ModelReturn implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['return'] - * @var int - */ - 'return' => null, - ); + protected $container = array(); /** * Constructor @@ -122,13 +117,7 @@ class ModelReturn implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["return"])) { - $this->container['return'] = $data["return"]; - } - } + $this->container['return'] = isset($data['return']) ? $data['return'] : null; } /** @@ -153,6 +142,7 @@ class ModelReturn implements ArrayAccess return true; } + /** * Gets return * @return int 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 e9f40099d6c..1684be6409a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Name.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Name Class Doc Comment * @@ -61,7 +62,7 @@ class Name implements ArrayAccess 'snake_case' => 'int', 'property' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -75,7 +76,7 @@ class Name implements ArrayAccess 'snake_case' => 'snake_case', 'property' => 'property' ); - + static function attributeMap() { return self::$attributeMap; } @@ -89,7 +90,7 @@ class Name implements ArrayAccess 'snake_case' => 'setSnakeCase', 'property' => 'setProperty' ); - + static function setters() { return self::$setters; } @@ -116,25 +117,7 @@ class Name implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['name'] - * @var int - */ - 'name' => null, - - /** - * $container['snake_case'] - * @var int - */ - 'snake_case' => null, - - /** - * $container['property'] - * @var string - */ - 'property' => null, - ); + protected $container = array(); /** * Constructor @@ -142,19 +125,9 @@ class Name implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - 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"]; - } - } + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['snake_case'] = isset($data['snake_case']) ? $data['snake_case'] : null; + $this->container['property'] = isset($data['property']) ? $data['property'] : null; } /** @@ -185,6 +158,7 @@ class Name implements ArrayAccess return true; } + /** * Gets name * @return int @@ -205,6 +179,7 @@ class Name implements ArrayAccess return $this; } + /** * Gets snake_case * @return int @@ -225,6 +200,7 @@ class Name implements ArrayAccess return $this; } + /** * Gets property * @return string 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 233a6abd1bc..88779ed8c73 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Order Class Doc Comment * @@ -64,7 +65,7 @@ class Order implements ArrayAccess 'status' => 'string', 'complete' => 'bool' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -81,7 +82,7 @@ class Order implements ArrayAccess 'status' => 'status', 'complete' => 'complete' ); - + static function attributeMap() { return self::$attributeMap; } @@ -98,7 +99,7 @@ class Order implements ArrayAccess 'status' => 'setStatus', 'complete' => 'setComplete' ); - + static function setters() { return self::$setters; } @@ -143,43 +144,7 @@ class Order implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['pet_id'] - * @var int - */ - 'pet_id' => null, - - /** - * $container['quantity'] - * @var int - */ - 'quantity' => null, - - /** - * $container['ship_date'] - * @var \DateTime - */ - 'ship_date' => null, - - /** - * $container['status'] Order Status - * @var string - */ - 'status' => null, - - /** - * $container['complete'] - * @var bool - */ - 'complete' => false, - ); + protected $container = array(); /** * Constructor @@ -187,28 +152,12 @@ class Order implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - 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"]; - } - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['pet_id'] = isset($data['pet_id']) ? $data['pet_id'] : null; + $this->container['quantity'] = isset($data['quantity']) ? $data['quantity'] : null; + $this->container['ship_date'] = isset($data['ship_date']) ? $data['ship_date'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->container['complete'] = isset($data['complete']) ? $data['complete'] : false; } /** @@ -241,6 +190,7 @@ class Order implements ArrayAccess return true; } + /** * Gets id * @return int @@ -261,6 +211,7 @@ class Order implements ArrayAccess return $this; } + /** * Gets pet_id * @return int @@ -281,6 +232,7 @@ class Order implements ArrayAccess return $this; } + /** * Gets quantity * @return int @@ -301,6 +253,7 @@ class Order implements ArrayAccess return $this; } + /** * Gets ship_date * @return \DateTime @@ -321,6 +274,7 @@ class Order implements ArrayAccess return $this; } + /** * Gets status * @return string @@ -345,6 +299,7 @@ class Order implements ArrayAccess return $this; } + /** * Gets complete * @return bool 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 2aab87c1ab9..5a65e432538 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Pet Class Doc Comment * @@ -64,7 +65,7 @@ class Pet implements ArrayAccess 'tags' => '\Swagger\Client\Model\Tag[]', 'status' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -81,7 +82,7 @@ class Pet implements ArrayAccess 'tags' => 'tags', 'status' => 'status' ); - + static function attributeMap() { return self::$attributeMap; } @@ -98,7 +99,7 @@ class Pet implements ArrayAccess 'tags' => 'setTags', 'status' => 'setStatus' ); - + static function setters() { return self::$setters; } @@ -143,43 +144,7 @@ class Pet implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['category'] - * @var \Swagger\Client\Model\Category - */ - 'category' => null, - - /** - * $container['name'] - * @var string - */ - 'name' => null, - - /** - * $container['photo_urls'] - * @var string[] - */ - 'photo_urls' => null, - - /** - * $container['tags'] - * @var \Swagger\Client\Model\Tag[] - */ - 'tags' => null, - - /** - * $container['status'] pet status in the store - * @var string - */ - 'status' => null, - ); + protected $container = array(); /** * Constructor @@ -187,28 +152,12 @@ class Pet implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - 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"]; - } - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['category'] = isset($data['category']) ? $data['category'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['photo_urls'] = isset($data['photo_urls']) ? $data['photo_urls'] : null; + $this->container['tags'] = isset($data['tags']) ? $data['tags'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; } /** @@ -253,6 +202,7 @@ class Pet implements ArrayAccess return true; } + /** * Gets id * @return int @@ -273,6 +223,7 @@ class Pet implements ArrayAccess return $this; } + /** * Gets category * @return \Swagger\Client\Model\Category @@ -293,6 +244,7 @@ class Pet implements ArrayAccess return $this; } + /** * Gets name * @return string @@ -313,6 +265,7 @@ class Pet implements ArrayAccess return $this; } + /** * Gets photo_urls * @return string[] @@ -333,6 +286,7 @@ class Pet implements ArrayAccess return $this; } + /** * Gets tags * @return \Swagger\Client\Model\Tag[] @@ -353,6 +307,7 @@ class Pet implements ArrayAccess return $this; } + /** * Gets status * @return string 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 00f91f201b6..25ebecd55a0 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/SpecialModelName.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * SpecialModelName Class Doc Comment * @@ -59,7 +60,7 @@ class SpecialModelName implements ArrayAccess static $swaggerTypes = array( 'special_property_name' => 'int' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -71,7 +72,7 @@ class SpecialModelName implements ArrayAccess static $attributeMap = array( 'special_property_name' => '$special[property.name]' ); - + static function attributeMap() { return self::$attributeMap; } @@ -83,7 +84,7 @@ class SpecialModelName implements ArrayAccess static $setters = array( 'special_property_name' => 'setSpecialPropertyName' ); - + static function setters() { return self::$setters; } @@ -108,13 +109,7 @@ class SpecialModelName implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['special_property_name'] - * @var int - */ - 'special_property_name' => null, - ); + protected $container = array(); /** * Constructor @@ -122,13 +117,7 @@ class SpecialModelName implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["special_property_name"])) { - $this->container['special_property_name'] = $data["special_property_name"]; - } - } + $this->container['special_property_name'] = isset($data['special_property_name']) ? $data['special_property_name'] : null; } /** @@ -153,6 +142,7 @@ class SpecialModelName implements ArrayAccess return true; } + /** * Gets special_property_name * @return int 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 c141024188b..a2132ca7e5c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Tag.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * Tag Class Doc Comment * @@ -60,7 +61,7 @@ class Tag implements ArrayAccess 'id' => 'int', 'name' => 'string' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -73,7 +74,7 @@ class Tag implements ArrayAccess 'id' => 'id', 'name' => 'name' ); - + static function attributeMap() { return self::$attributeMap; } @@ -86,7 +87,7 @@ class Tag implements ArrayAccess 'id' => 'setId', 'name' => 'setName' ); - + static function setters() { return self::$setters; } @@ -112,19 +113,7 @@ class Tag implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['name'] - * @var string - */ - 'name' => null, - ); + protected $container = array(); /** * Constructor @@ -132,16 +121,8 @@ class Tag implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - if (isset($data["id"])) { - $this->container['id'] = $data["id"]; - } - if (isset($data["name"])) { - $this->container['name'] = $data["name"]; - } - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; } /** @@ -166,6 +147,7 @@ class Tag implements ArrayAccess return true; } + /** * Gets id * @return int @@ -186,6 +168,7 @@ class Tag implements ArrayAccess return $this; } + /** * Gets name * @return string 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 9018e342a1d..a97727f0a8f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/User.php @@ -34,6 +34,7 @@ namespace Swagger\Client\Model; use \ArrayAccess; + /** * User Class Doc Comment * @@ -66,7 +67,7 @@ class User implements ArrayAccess 'phone' => 'string', 'user_status' => 'int' ); - + static function swaggerTypes() { return self::$swaggerTypes; } @@ -85,7 +86,7 @@ class User implements ArrayAccess 'phone' => 'phone', 'user_status' => 'userStatus' ); - + static function attributeMap() { return self::$attributeMap; } @@ -104,7 +105,7 @@ class User implements ArrayAccess 'phone' => 'setPhone', 'user_status' => 'setUserStatus' ); - + static function setters() { return self::$setters; } @@ -136,55 +137,7 @@ class User implements ArrayAccess * Associative array for storing property values * @var mixed[] */ - protected $container = array( - /** - * $container['id'] - * @var int - */ - 'id' => null, - - /** - * $container['username'] - * @var string - */ - 'username' => null, - - /** - * $container['first_name'] - * @var string - */ - 'first_name' => null, - - /** - * $container['last_name'] - * @var string - */ - 'last_name' => null, - - /** - * $container['email'] - * @var string - */ - 'email' => null, - - /** - * $container['password'] - * @var string - */ - 'password' => null, - - /** - * $container['phone'] - * @var string - */ - 'phone' => null, - - /** - * $container['user_status'] User Status - * @var int - */ - 'user_status' => null, - ); + protected $container = array(); /** * Constructor @@ -192,34 +145,14 @@ class User implements ArrayAccess */ public function __construct(array $data = null) { - - - if ($data != null) { - 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"]; - } - } + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['username'] = isset($data['username']) ? $data['username'] : null; + $this->container['first_name'] = isset($data['first_name']) ? $data['first_name'] : null; + $this->container['last_name'] = isset($data['last_name']) ? $data['last_name'] : null; + $this->container['email'] = isset($data['email']) ? $data['email'] : null; + $this->container['password'] = isset($data['password']) ? $data['password'] : null; + $this->container['phone'] = isset($data['phone']) ? $data['phone'] : null; + $this->container['user_status'] = isset($data['user_status']) ? $data['user_status'] : null; } /** @@ -244,6 +177,7 @@ class User implements ArrayAccess return true; } + /** * Gets id * @return int @@ -264,6 +198,7 @@ class User implements ArrayAccess return $this; } + /** * Gets username * @return string @@ -284,6 +219,7 @@ class User implements ArrayAccess return $this; } + /** * Gets first_name * @return string @@ -304,6 +240,7 @@ class User implements ArrayAccess return $this; } + /** * Gets last_name * @return string @@ -324,6 +261,7 @@ class User implements ArrayAccess return $this; } + /** * Gets email * @return string @@ -344,6 +282,7 @@ class User implements ArrayAccess return $this; } + /** * Gets password * @return string @@ -364,6 +303,7 @@ class User implements ArrayAccess return $this; } + /** * Gets phone * @return string @@ -384,6 +324,7 @@ class User implements ArrayAccess return $this; } + /** * Gets user_status * @return int diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php index ac63c18fbd5..3adaa899f5f 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ObjectSerializer.php @@ -256,7 +256,7 @@ class ObjectSerializer } else { return null; } - } elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) { + } elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) { settype($data, $class); return $data; } elseif ($class === '\SplFileObject') {