forked from loafle/openapi-generator-original
[PHP] Improve Model template (#6460)
* Update samples ./bin/php-petstore.sh * Remove unnecessary implements entry ModelInterface, ArrayAccess are already implemented in parent * Remove field `container` which is already defined in parent * Change snake case to lower camel case - invalid_properties - allowed_values * Improve doc commenct style * Improve description length * Improve length * Doc comment short description must start with a capital letter * Add a line between @param and @return * Delete an additinal blank line at end of doc comment * Udpate petstore-security-test
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -30,15 +29,16 @@
|
||||
namespace Swagger\Client\Model;
|
||||
|
||||
use \ArrayAccess;
|
||||
use \Swagger\Client\ObjectSerializer;
|
||||
|
||||
/**
|
||||
* ModelReturn Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @category Class
|
||||
* @description Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* @package Swagger\Client
|
||||
* @author Swagger Codegen team
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
* @package Swagger\Client
|
||||
* @author Swagger Codegen team
|
||||
* @link https://github.com/swagger-api/swagger-codegen
|
||||
*/
|
||||
class ModelReturn implements ModelInterface, ArrayAccess
|
||||
{
|
||||
@@ -46,12 +46,14 @@ class ModelReturn implements ModelInterface, ArrayAccess
|
||||
|
||||
/**
|
||||
* The original name of the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $swaggerModelName = 'Return';
|
||||
|
||||
/**
|
||||
* Array of property to type mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $swaggerTypes = [
|
||||
@@ -60,6 +62,7 @@ class ModelReturn implements ModelInterface, ArrayAccess
|
||||
|
||||
/**
|
||||
* Array of property to format mappings. Used for (de)serialization
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $swaggerFormats = [
|
||||
@@ -87,7 +90,9 @@ class ModelReturn implements ModelInterface, ArrayAccess
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name, and the value is the original name
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $attributeMap = [
|
||||
@@ -96,6 +101,7 @@ class ModelReturn implements ModelInterface, ArrayAccess
|
||||
|
||||
/**
|
||||
* Array of attributes to setter functions (for deserialization of responses)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $setters = [
|
||||
@@ -104,6 +110,7 @@ class ModelReturn implements ModelInterface, ArrayAccess
|
||||
|
||||
/**
|
||||
* Array of attributes to getter functions (for serialization of requests)
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $getters = [
|
||||
@@ -111,7 +118,8 @@ class ModelReturn implements ModelInterface, ArrayAccess
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of attributes where the key is the local name, and the value is the original name
|
||||
* Array of attributes where the key is the local name,
|
||||
* and the value is the original name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -156,13 +164,16 @@ class ModelReturn implements ModelInterface, ArrayAccess
|
||||
|
||||
/**
|
||||
* Associative array for storing property values
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
protected $container = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property values initializing the model
|
||||
*
|
||||
* @param mixed[] $data Associated array of property values
|
||||
* initializing the model
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
@@ -176,13 +187,13 @@ class ModelReturn implements ModelInterface, ArrayAccess
|
||||
*/
|
||||
public function listInvalidProperties()
|
||||
{
|
||||
$invalid_properties = [];
|
||||
$invalidProperties = [];
|
||||
|
||||
return $invalid_properties;
|
||||
return $invalidProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate all the properties in the model
|
||||
* Validate all the properties in the model
|
||||
* return true if all passed
|
||||
*
|
||||
* @return bool True if all properties are valid
|
||||
@@ -196,6 +207,7 @@ class ModelReturn implements ModelInterface, ArrayAccess
|
||||
|
||||
/**
|
||||
* Gets return
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getReturn()
|
||||
@@ -205,7 +217,9 @@ class ModelReturn implements ModelInterface, ArrayAccess
|
||||
|
||||
/**
|
||||
* Sets return
|
||||
*
|
||||
* @param int $return property description *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setReturn($return)
|
||||
@@ -216,7 +230,9 @@ class ModelReturn implements ModelInterface, ArrayAccess
|
||||
}
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
@@ -226,7 +242,9 @@ class ModelReturn implements ModelInterface, ArrayAccess
|
||||
|
||||
/**
|
||||
* Gets offset.
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
@@ -236,8 +254,10 @@ class ModelReturn implements ModelInterface, ArrayAccess
|
||||
|
||||
/**
|
||||
* Sets value based on offset.
|
||||
* @param integer $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
* @param mixed $value Value to be set
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
@@ -251,7 +271,9 @@ class ModelReturn implements ModelInterface, ArrayAccess
|
||||
|
||||
/**
|
||||
* Unsets offset.
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @param integer $offset Offset
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
@@ -261,15 +283,19 @@ class ModelReturn implements ModelInterface, ArrayAccess
|
||||
|
||||
/**
|
||||
* 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(
|
||||
ObjectSerializer::sanitizeForSerialization($this),
|
||||
JSON_PRETTY_PRINT
|
||||
);
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Contact: apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r
|
||||
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user