From 363c40ec5522e0064bd8822a05d66f33ee59eaee Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 10 May 2016 00:39:55 +0800 Subject: [PATCH] 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') {