Merge pull request #2393 from wing328/model_start_with_number

[PHP] better handling of model name starting with number
This commit is contained in:
wing328 2016-03-16 23:25:42 +08:00
commit ec03403492
11 changed files with 336 additions and 143 deletions

View File

@ -407,6 +407,12 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
name = "model_" + name; // e.g. return => ModelReturn (after camelize) name = "model_" + name; // e.g. return => ModelReturn (after camelize)
} }
// model name starts with number
if (name.matches("^\\d.*")) {
LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name));
name = "model_" + name; // e.g. 200Response => Model200Response (after camelize)
}
// add prefix and/or suffic only if name does not start wth \ (e.g. \DateTime) // add prefix and/or suffic only if name does not start wth \ (e.g. \DateTime)
if (!name.matches("^\\\\.*")) { if (!name.matches("^\\\\.*")) {
name = modelNamePrefix + name + modelNameSuffix; name = modelNamePrefix + name + modelNameSuffix;

View File

@ -1313,7 +1313,19 @@
} }
}, },
"Name": { "Name": {
"descripton": "Model for testing reserved words", "descripton": "Model for testing model name same as property name",
"properties": {
"name": {
"type": "integer",
"format": "int32"
}
},
"xml": {
"name": "Name"
}
},
"200_response": {
"descripton": "Model for testing model name starting with number",
"properties": { "properties": {
"name": { "name": {
"type": "integer", "type": "integer",

View File

@ -77,6 +77,7 @@ Class | Method | HTTP request | Description
- [Category](docs/Category.md) - [Category](docs/Category.md)
- [InlineResponse200](docs/InlineResponse200.md) - [InlineResponse200](docs/InlineResponse200.md)
- [Model200Response](docs/Model200Response.md)
- [ModelReturn](docs/ModelReturn.md) - [ModelReturn](docs/ModelReturn.md)
- [Name](docs/Name.md) - [Name](docs/Name.md)
- [Order](docs/Order.md) - [Order](docs/Order.md)
@ -89,25 +90,10 @@ Class | Method | HTTP request | Description
## Documentation For Authorization ## Documentation For Authorization
## petstore_auth ## test_api_key_header
- **Type**: OAuth
- **Flow**: implicit
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- **write:pets**: modify pets in your account
- **read:pets**: read your pets
## test_api_client_id
- **Type**: API key - **Type**: API key
- **API key parameter name**: x-test_api_client_id - **API key parameter name**: test_api_key_header
- **Location**: HTTP header
## test_api_client_secret
- **Type**: API key
- **API key parameter name**: x-test_api_client_secret
- **Location**: HTTP header - **Location**: HTTP header
## api_key ## api_key
@ -120,17 +106,32 @@ Class | Method | HTTP request | Description
- **Type**: HTTP basic authentication - **Type**: HTTP basic authentication
## test_api_client_secret
- **Type**: API key
- **API key parameter name**: x-test_api_client_secret
- **Location**: HTTP header
## test_api_client_id
- **Type**: API key
- **API key parameter name**: x-test_api_client_id
- **Location**: HTTP header
## test_api_key_query ## test_api_key_query
- **Type**: API key - **Type**: API key
- **API key parameter name**: test_api_key_query - **API key parameter name**: test_api_key_query
- **Location**: URL query string - **Location**: URL query string
## test_api_key_header ## petstore_auth
- **Type**: API key - **Type**: OAuth
- **API key parameter name**: test_api_key_header - **Flow**: implicit
- **Location**: HTTP header - **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- **write:pets**: modify pets in your account
- **read:pets**: read your pets
## Author ## Author

View File

@ -3,12 +3,12 @@
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**photo_urls** | **string[]** | | [optional] **tags** | [**\Swagger\Client\Model\Tag[]**](Tag.md) | | [optional]
**name** | **string** | | [optional]
**id** | **int** | | **id** | **int** | |
**category** | **object** | | [optional] **category** | **object** | | [optional]
**tags** | [**\Swagger\Client\Model\Tag[]**](Tag.md) | | [optional]
**status** | **string** | pet status in the store | [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) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -268,12 +268,12 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN');
// Configure API key authorization: api_key // Configure API key authorization: api_key
Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY'); Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER'); // Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER');
// Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Swagger\Client\PetApi(); $api_instance = new Swagger\Client\PetApi();
$pet_id = 789; // int | ID of pet that needs to be fetched $pet_id = 789; // int | ID of pet that needs to be fetched
@ -299,7 +299,7 @@ Name | Type | Description | Notes
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers ### HTTP reuqest headers
@ -320,12 +320,12 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN');
// Configure API key authorization: api_key // Configure API key authorization: api_key
Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY'); Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER'); // Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER');
// Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Swagger\Client\PetApi(); $api_instance = new Swagger\Client\PetApi();
$pet_id = 789; // int | ID of pet that needs to be fetched $pet_id = 789; // int | ID of pet that needs to be fetched
@ -351,7 +351,7 @@ Name | Type | Description | Notes
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers ### HTTP reuqest headers
@ -372,12 +372,12 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN');
// Configure API key authorization: api_key // Configure API key authorization: api_key
Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY'); Swagger\Client::getDefaultConfiguration->setApiKey('api_key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER'); // Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('api_key', 'BEARER');
// Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client::getDefaultConfiguration->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Swagger\Client\PetApi(); $api_instance = new Swagger\Client\PetApi();
$pet_id = 789; // int | ID of pet that needs to be fetched $pet_id = 789; // int | ID of pet that needs to be fetched
@ -403,7 +403,7 @@ Name | Type | Description | Notes
### Authorization ### Authorization
[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
### HTTP reuqest headers ### HTTP reuqest headers

View File

@ -214,14 +214,14 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: test_api_key_query
Swagger\Client::getDefaultConfiguration->setApiKey('test_api_key_query', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('test_api_key_query', 'BEARER');
// Configure API key authorization: test_api_key_header // Configure API key authorization: test_api_key_header
Swagger\Client::getDefaultConfiguration->setApiKey('test_api_key_header', 'YOUR_API_KEY'); Swagger\Client::getDefaultConfiguration->setApiKey('test_api_key_header', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('test_api_key_header', 'BEARER'); // Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('test_api_key_header', 'BEARER');
// Configure API key authorization: test_api_key_query
Swagger\Client::getDefaultConfiguration->setApiKey('test_api_key_query', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
// Swagger\Client::getDefaultConfiguration->setApiKeyPrefix('test_api_key_query', 'BEARER');
$api_instance = new Swagger\Client\StoreApi(); $api_instance = new Swagger\Client\StoreApi();
$order_id = "order_id_example"; // string | ID of pet that needs to be fetched $order_id = "order_id_example"; // string | ID of pet that needs to be fetched
@ -247,7 +247,7 @@ Name | Type | Description | Notes
### Authorization ### Authorization
[test_api_key_query](../README.md#test_api_key_query), [test_api_key_header](../README.md#test_api_key_header) [test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query)
### HTTP reuqest headers ### HTTP reuqest headers

View File

@ -618,11 +618,6 @@ class PetApi
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// this endpoint requires API key authentication // this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key'); $apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
if (strlen($apiKey) !== 0) { if (strlen($apiKey) !== 0) {
@ -630,6 +625,11 @@ class PetApi
} }
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// make the API Call // make the API Call
try { try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
@ -725,11 +725,6 @@ class PetApi
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// this endpoint requires API key authentication // this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key'); $apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
if (strlen($apiKey) !== 0) { if (strlen($apiKey) !== 0) {
@ -737,6 +732,11 @@ class PetApi
} }
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// make the API Call // make the API Call
try { try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
@ -832,11 +832,6 @@ class PetApi
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// this endpoint requires API key authentication // this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('api_key'); $apiKey = $this->apiClient->getApiKeyWithPrefix('api_key');
if (strlen($apiKey) !== 0) { if (strlen($apiKey) !== 0) {
@ -844,6 +839,11 @@ class PetApi
} }
// this endpoint requires OAuth (access token)
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
}
// make the API Call // make the API Call
try { try {
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(

View File

@ -525,16 +525,16 @@ class StoreApi
} }
// this endpoint requires API key authentication // this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_query'); $apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_header');
if (strlen($apiKey) !== 0) { if (strlen($apiKey) !== 0) {
$queryParams['test_api_key_query'] = $apiKey; $headerParams['test_api_key_header'] = $apiKey;
} }
// this endpoint requires API key authentication // this endpoint requires API key authentication
$apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_header'); $apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_query');
if (strlen($apiKey) !== 0) { if (strlen($apiKey) !== 0) {
$headerParams['test_api_key_header'] = $apiKey; $queryParams['test_api_key_query'] = $apiKey;
} }

View File

@ -51,12 +51,12 @@ class InlineResponse200 implements ArrayAccess
* @var string[] * @var string[]
*/ */
static $swaggerTypes = array( static $swaggerTypes = array(
'photo_urls' => 'string[]', 'tags' => '\Swagger\Client\Model\Tag[]',
'name' => 'string',
'id' => 'int', 'id' => 'int',
'category' => 'object', 'category' => 'object',
'tags' => '\Swagger\Client\Model\Tag[]', 'status' => 'string',
'status' => 'string' 'name' => 'string',
'photo_urls' => 'string[]'
); );
/** /**
@ -64,12 +64,12 @@ class InlineResponse200 implements ArrayAccess
* @var string[] * @var string[]
*/ */
static $attributeMap = array( static $attributeMap = array(
'photo_urls' => 'photoUrls', 'tags' => 'tags',
'name' => 'name',
'id' => 'id', 'id' => 'id',
'category' => 'category', 'category' => 'category',
'tags' => 'tags', 'status' => 'status',
'status' => 'status' 'name' => 'name',
'photo_urls' => 'photoUrls'
); );
/** /**
@ -77,12 +77,12 @@ class InlineResponse200 implements ArrayAccess
* @var string[] * @var string[]
*/ */
static $setters = array( static $setters = array(
'photo_urls' => 'setPhotoUrls', 'tags' => 'setTags',
'name' => 'setName',
'id' => 'setId', 'id' => 'setId',
'category' => 'setCategory', 'category' => 'setCategory',
'tags' => 'setTags', 'status' => 'setStatus',
'status' => 'setStatus' 'name' => 'setName',
'photo_urls' => 'setPhotoUrls'
); );
/** /**
@ -90,26 +90,20 @@ class InlineResponse200 implements ArrayAccess
* @var string[] * @var string[]
*/ */
static $getters = array( static $getters = array(
'photo_urls' => 'getPhotoUrls', 'tags' => 'getTags',
'name' => 'getName',
'id' => 'getId', 'id' => 'getId',
'category' => 'getCategory', 'category' => 'getCategory',
'tags' => 'getTags', 'status' => 'getStatus',
'status' => 'getStatus' 'name' => 'getName',
'photo_urls' => 'getPhotoUrls'
); );
/** /**
* $photo_urls * $tags
* @var string[] * @var \Swagger\Client\Model\Tag[]
*/ */
protected $photo_urls; protected $tags;
/**
* $name
* @var string
*/
protected $name;
/** /**
* $id * $id
@ -123,18 +117,24 @@ class InlineResponse200 implements ArrayAccess
*/ */
protected $category; protected $category;
/**
* $tags
* @var \Swagger\Client\Model\Tag[]
*/
protected $tags;
/** /**
* $status pet status in the store * $status pet status in the store
* @var string * @var string
*/ */
protected $status; protected $status;
/**
* $name
* @var string
*/
protected $name;
/**
* $photo_urls
* @var string[]
*/
protected $photo_urls;
/** /**
* Constructor * Constructor
@ -143,54 +143,33 @@ class InlineResponse200 implements ArrayAccess
public function __construct(array $data = null) public function __construct(array $data = null)
{ {
if ($data != null) { if ($data != null) {
$this->photo_urls = $data["photo_urls"]; $this->tags = $data["tags"];
$this->name = $data["name"];
$this->id = $data["id"]; $this->id = $data["id"];
$this->category = $data["category"]; $this->category = $data["category"];
$this->tags = $data["tags"];
$this->status = $data["status"]; $this->status = $data["status"];
$this->name = $data["name"];
$this->photo_urls = $data["photo_urls"];
} }
} }
/** /**
* Gets photo_urls * Gets tags
* @return string[] * @return \Swagger\Client\Model\Tag[]
*/ */
public function getPhotoUrls() public function getTags()
{ {
return $this->photo_urls; return $this->tags;
} }
/** /**
* Sets photo_urls * Sets tags
* @param string[] $photo_urls * @param \Swagger\Client\Model\Tag[] $tags
* @return $this * @return $this
*/ */
public function setPhotoUrls($photo_urls) public function setTags($tags)
{ {
$this->photo_urls = $photo_urls; $this->tags = $tags;
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; return $this;
} }
@ -236,27 +215,6 @@ class InlineResponse200 implements ArrayAccess
return $this; return $this;
} }
/**
* 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 status * Gets status
* @return string * @return string
@ -281,6 +239,48 @@ class InlineResponse200 implements ArrayAccess
return $this; 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. * Returns true if offset exists. False otherwise.
* @param integer $offset Offset * @param integer $offset Offset

View File

@ -0,0 +1,174 @@
<?php
/**
* Model200Response
*
* PHP version 5
*
* @category Class
* @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen
*/
/**
* Copyright 2016 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
namespace Swagger\Client\Model;
use \ArrayAccess;
/**
* Model200Response Class Doc Comment
*
* @category Class
* @description
* @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen
*/
class Model200Response implements ArrayAccess
{
/**
* Array of property to type mappings. Used for (de)serialization
* @var string[]
*/
static $swaggerTypes = array(
'name' => 'int'
);
/**
* Array of attributes where the key is the local name, and the value is the original name
* @var string[]
*/
static $attributeMap = array(
'name' => 'name'
);
/**
* Array of attributes to setter functions (for deserialization of responses)
* @var string[]
*/
static $setters = array(
'name' => 'setName'
);
/**
* Array of attributes to getter functions (for serialization of requests)
* @var string[]
*/
static $getters = array(
'name' => 'getName'
);
/**
* $name
* @var int
*/
protected $name;
/**
* Constructor
* @param mixed[] $data Associated array of property value initalizing the model
*/
public function __construct(array $data = null)
{
if ($data != null) {
$this->name = $data["name"];
}
}
/**
* Gets name
* @return int
*/
public function getName()
{
return $this->name;
}
/**
* Sets name
* @param int $name
* @return $this
*/
public function setName($name)
{
$this->name = $name;
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));
}
}
}

View File

@ -256,7 +256,7 @@ class ObjectSerializer
} else { } else {
$deserialized = null; $deserialized = 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); settype($data, $class);
$deserialized = $data; $deserialized = $data;
} elseif ($class === '\SplFileObject') { } elseif ($class === '\SplFileObject') {