forked from loafle/openapi-generator-original
Merge pull request #3126 from arnested/php-empty-array-response
[PHP] Handle empty array response correct
This commit is contained in:
commit
db32c26cc5
@ -244,11 +244,8 @@ use \{{invokerPackage}}\ObjectSerializer;
|
|||||||
$headerParams{{#returnType}},
|
$headerParams{{#returnType}},
|
||||||
'{{returnType}}'{{/returnType}}
|
'{{returnType}}'{{/returnType}}
|
||||||
);
|
);
|
||||||
{{#returnType}}
|
|
||||||
if (!$response) {
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
{{#returnType}}
|
||||||
return array($this->apiClient->getSerializer()->deserialize($response, '{{returnType}}', $httpHeader{{#discriminator}}, '{{discriminator}}'{{/discriminator}}), $statusCode, $httpHeader);
|
return array($this->apiClient->getSerializer()->deserialize($response, '{{returnType}}', $httpHeader{{#discriminator}}, '{{discriminator}}'{{/discriminator}}), $statusCode, $httpHeader);
|
||||||
{{/returnType}}
|
{{/returnType}}
|
||||||
{{^returnType}}
|
{{^returnType}}
|
||||||
|
@ -4,8 +4,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, mod
|
|||||||
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||||
|
|
||||||
- API version: 1.0.0
|
- API version: 1.0.0
|
||||||
- Package version:
|
- Build date: 2016-06-13T23:22:10.454+02:00
|
||||||
- Build date: 2016-05-25T22:55:19.912+02:00
|
|
||||||
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
|
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
## Properties
|
## Properties
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**map_property** | **map[string,string]** | | [optional]
|
||||||
|
**map_of_map_property** | [**map[string,map[string,string]]**](map.md) | | [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)
|
||||||
|
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
## Properties
|
## Properties
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**array_of_string** | **string[]** | | [optional]
|
||||||
|
**array_array_of_integer** | [**int[][]**](array.md) | | [optional]
|
||||||
|
**array_array_of_model** | [**\Swagger\Client\Model\ReadOnlyFirst[][]**](array.md) | | [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)
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ Name | Type | Description | Notes
|
|||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
**uuid** | **string** | | [optional]
|
**uuid** | **string** | | [optional]
|
||||||
**date_time** | [**\DateTime**](\DateTime.md) | | [optional]
|
**date_time** | [**\DateTime**](\DateTime.md) | | [optional]
|
||||||
|
**map** | [**map[string,\Swagger\Client\Model\Animal]**](Animal.md) | | [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)
|
||||||
|
|
||||||
|
@ -289,6 +289,7 @@ class FakeApi
|
|||||||
$httpBody,
|
$httpBody,
|
||||||
$headerParams
|
$headerParams
|
||||||
);
|
);
|
||||||
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
return array(null, $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
switch ($e->getCode()) {
|
switch ($e->getCode()) {
|
||||||
|
@ -182,6 +182,7 @@ class PetApi
|
|||||||
$httpBody,
|
$httpBody,
|
||||||
$headerParams
|
$headerParams
|
||||||
);
|
);
|
||||||
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
return array(null, $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
switch ($e->getCode()) {
|
switch ($e->getCode()) {
|
||||||
@ -278,6 +279,7 @@ class PetApi
|
|||||||
$httpBody,
|
$httpBody,
|
||||||
$headerParams
|
$headerParams
|
||||||
);
|
);
|
||||||
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
return array(null, $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
switch ($e->getCode()) {
|
switch ($e->getCode()) {
|
||||||
@ -369,9 +371,6 @@ class PetApi
|
|||||||
$headerParams,
|
$headerParams,
|
||||||
'\Swagger\Client\Model\Pet[]'
|
'\Swagger\Client\Model\Pet[]'
|
||||||
);
|
);
|
||||||
if (!$response) {
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader);
|
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
@ -468,9 +467,6 @@ class PetApi
|
|||||||
$headerParams,
|
$headerParams,
|
||||||
'\Swagger\Client\Model\Pet[]'
|
'\Swagger\Client\Model\Pet[]'
|
||||||
);
|
);
|
||||||
if (!$response) {
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader);
|
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
@ -570,9 +566,6 @@ class PetApi
|
|||||||
$headerParams,
|
$headerParams,
|
||||||
'\Swagger\Client\Model\Pet'
|
'\Swagger\Client\Model\Pet'
|
||||||
);
|
);
|
||||||
if (!$response) {
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet', $httpHeader), $statusCode, $httpHeader);
|
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet', $httpHeader), $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
@ -666,6 +659,7 @@ class PetApi
|
|||||||
$httpBody,
|
$httpBody,
|
||||||
$headerParams
|
$headerParams
|
||||||
);
|
);
|
||||||
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
return array(null, $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
switch ($e->getCode()) {
|
switch ($e->getCode()) {
|
||||||
@ -767,6 +761,7 @@ class PetApi
|
|||||||
$httpBody,
|
$httpBody,
|
||||||
$headerParams
|
$headerParams
|
||||||
);
|
);
|
||||||
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
return array(null, $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
switch ($e->getCode()) {
|
switch ($e->getCode()) {
|
||||||
@ -875,9 +870,6 @@ class PetApi
|
|||||||
$headerParams,
|
$headerParams,
|
||||||
'\Swagger\Client\Model\ApiResponse'
|
'\Swagger\Client\Model\ApiResponse'
|
||||||
);
|
);
|
||||||
if (!$response) {
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\ApiResponse', $httpHeader), $statusCode, $httpHeader);
|
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\ApiResponse', $httpHeader), $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
|
@ -184,6 +184,7 @@ class StoreApi
|
|||||||
$httpBody,
|
$httpBody,
|
||||||
$headerParams
|
$headerParams
|
||||||
);
|
);
|
||||||
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
return array(null, $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
switch ($e->getCode()) {
|
switch ($e->getCode()) {
|
||||||
@ -264,9 +265,6 @@ class StoreApi
|
|||||||
$headerParams,
|
$headerParams,
|
||||||
'map[string,int]'
|
'map[string,int]'
|
||||||
);
|
);
|
||||||
if (!$response) {
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array($this->apiClient->getSerializer()->deserialize($response, 'map[string,int]', $httpHeader), $statusCode, $httpHeader);
|
return array($this->apiClient->getSerializer()->deserialize($response, 'map[string,int]', $httpHeader), $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
@ -366,9 +364,6 @@ class StoreApi
|
|||||||
$headerParams,
|
$headerParams,
|
||||||
'\Swagger\Client\Model\Order'
|
'\Swagger\Client\Model\Order'
|
||||||
);
|
);
|
||||||
if (!$response) {
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader);
|
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
@ -458,9 +453,6 @@ class StoreApi
|
|||||||
$headerParams,
|
$headerParams,
|
||||||
'\Swagger\Client\Model\Order'
|
'\Swagger\Client\Model\Order'
|
||||||
);
|
);
|
||||||
if (!$response) {
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader);
|
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
|
@ -177,6 +177,7 @@ class UserApi
|
|||||||
$httpBody,
|
$httpBody,
|
||||||
$headerParams
|
$headerParams
|
||||||
);
|
);
|
||||||
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
return array(null, $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
switch ($e->getCode()) {
|
switch ($e->getCode()) {
|
||||||
@ -260,6 +261,7 @@ class UserApi
|
|||||||
$httpBody,
|
$httpBody,
|
||||||
$headerParams
|
$headerParams
|
||||||
);
|
);
|
||||||
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
return array(null, $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
switch ($e->getCode()) {
|
switch ($e->getCode()) {
|
||||||
@ -343,6 +345,7 @@ class UserApi
|
|||||||
$httpBody,
|
$httpBody,
|
||||||
$headerParams
|
$headerParams
|
||||||
);
|
);
|
||||||
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
return array(null, $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
switch ($e->getCode()) {
|
switch ($e->getCode()) {
|
||||||
@ -429,6 +432,7 @@ class UserApi
|
|||||||
$httpBody,
|
$httpBody,
|
||||||
$headerParams
|
$headerParams
|
||||||
);
|
);
|
||||||
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
return array(null, $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
switch ($e->getCode()) {
|
switch ($e->getCode()) {
|
||||||
@ -516,9 +520,6 @@ class UserApi
|
|||||||
$headerParams,
|
$headerParams,
|
||||||
'\Swagger\Client\Model\User'
|
'\Swagger\Client\Model\User'
|
||||||
);
|
);
|
||||||
if (!$response) {
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\User', $httpHeader), $statusCode, $httpHeader);
|
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\User', $httpHeader), $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
@ -617,9 +618,6 @@ class UserApi
|
|||||||
$headerParams,
|
$headerParams,
|
||||||
'string'
|
'string'
|
||||||
);
|
);
|
||||||
if (!$response) {
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array($this->apiClient->getSerializer()->deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader);
|
return array($this->apiClient->getSerializer()->deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
@ -697,6 +695,7 @@ class UserApi
|
|||||||
$httpBody,
|
$httpBody,
|
||||||
$headerParams
|
$headerParams
|
||||||
);
|
);
|
||||||
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
return array(null, $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
switch ($e->getCode()) {
|
switch ($e->getCode()) {
|
||||||
@ -794,6 +793,7 @@ class UserApi
|
|||||||
$httpBody,
|
$httpBody,
|
||||||
$headerParams
|
$headerParams
|
||||||
);
|
);
|
||||||
|
|
||||||
return array(null, $statusCode, $httpHeader);
|
return array(null, $statusCode, $httpHeader);
|
||||||
} catch (ApiException $e) {
|
} catch (ApiException $e) {
|
||||||
switch ($e->getCode()) {
|
switch ($e->getCode()) {
|
||||||
|
@ -116,7 +116,7 @@ class Configuration
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $userAgent = "Swagger-Codegen//php";
|
protected $userAgent = "Swagger-Codegen/1.0.0/php";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Debug switch (default set to false)
|
* Debug switch (default set to false)
|
||||||
@ -519,12 +519,11 @@ class Configuration
|
|||||||
*/
|
*/
|
||||||
public static function toDebugReport()
|
public static function toDebugReport()
|
||||||
{
|
{
|
||||||
$report = "PHP SDK (Swagger\Client) Debug Report:".PHP_EOL;
|
$report = 'PHP SDK (Swagger\Client) Debug Report:' . PHP_EOL;
|
||||||
$report .= " OS: ".php_uname().PHP_EOL;
|
$report .= ' OS: ' . php_uname() . PHP_EOL;
|
||||||
$report .= " PHP Version: ".phpversion().PHP_EOL;
|
$report .= ' PHP Version: ' . phpversion() . PHP_EOL;
|
||||||
$report .= " OpenAPI Spec Version: 1.0.0".PHP_EOL;
|
$report .= ' OpenAPI Spec Version: 1.0.0' . PHP_EOL;
|
||||||
$report .= " SDK Package Version: ".PHP_EOL;
|
$report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;
|
||||||
$report .= " Temp Folder Path: ".self::getDefaultConfiguration()->getTempFolderPath().PHP_EOL;
|
|
||||||
|
|
||||||
return $report;
|
return $report;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,8 @@ class AdditionalPropertiesClass implements ArrayAccess
|
|||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected static $swaggerTypes = array(
|
protected static $swaggerTypes = array(
|
||||||
|
'map_property' => 'map[string,string]',
|
||||||
|
'map_of_map_property' => 'map[string,map[string,string]]'
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function swaggerTypes()
|
public static function swaggerTypes()
|
||||||
@ -78,7 +79,8 @@ class AdditionalPropertiesClass implements ArrayAccess
|
|||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected static $attributeMap = array(
|
protected static $attributeMap = array(
|
||||||
|
'map_property' => 'map_property',
|
||||||
|
'map_of_map_property' => 'map_of_map_property'
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function attributeMap()
|
public static function attributeMap()
|
||||||
@ -91,7 +93,8 @@ class AdditionalPropertiesClass implements ArrayAccess
|
|||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected static $setters = array(
|
protected static $setters = array(
|
||||||
|
'map_property' => 'setMapProperty',
|
||||||
|
'map_of_map_property' => 'setMapOfMapProperty'
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function setters()
|
public static function setters()
|
||||||
@ -104,7 +107,8 @@ class AdditionalPropertiesClass implements ArrayAccess
|
|||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected static $getters = array(
|
protected static $getters = array(
|
||||||
|
'map_property' => 'getMapProperty',
|
||||||
|
'map_of_map_property' => 'getMapOfMapProperty'
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function getters()
|
public static function getters()
|
||||||
@ -128,6 +132,8 @@ class AdditionalPropertiesClass implements ArrayAccess
|
|||||||
*/
|
*/
|
||||||
public function __construct(array $data = null)
|
public function __construct(array $data = null)
|
||||||
{
|
{
|
||||||
|
$this->container['map_property'] = isset($data['map_property']) ? $data['map_property'] : null;
|
||||||
|
$this->container['map_of_map_property'] = isset($data['map_of_map_property']) ? $data['map_of_map_property'] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,6 +158,48 @@ class AdditionalPropertiesClass implements ArrayAccess
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets map_property
|
||||||
|
* @return map[string,string]
|
||||||
|
*/
|
||||||
|
public function getMapProperty()
|
||||||
|
{
|
||||||
|
return $this->container['map_property'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets map_property
|
||||||
|
* @param map[string,string] $map_property
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setMapProperty($map_property)
|
||||||
|
{
|
||||||
|
$this->container['map_property'] = $map_property;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets map_of_map_property
|
||||||
|
* @return map[string,map[string,string]]
|
||||||
|
*/
|
||||||
|
public function getMapOfMapProperty()
|
||||||
|
{
|
||||||
|
return $this->container['map_of_map_property'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets map_of_map_property
|
||||||
|
* @param map[string,map[string,string]] $map_of_map_property
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setMapOfMapProperty($map_of_map_property)
|
||||||
|
{
|
||||||
|
$this->container['map_of_map_property'] = $map_of_map_property;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Returns true if offset exists. False otherwise.
|
* Returns true if offset exists. False otherwise.
|
||||||
* @param integer $offset Offset
|
* @param integer $offset Offset
|
||||||
|
@ -65,7 +65,9 @@ class ArrayTest implements ArrayAccess
|
|||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected static $swaggerTypes = array(
|
protected static $swaggerTypes = array(
|
||||||
|
'array_of_string' => 'string[]',
|
||||||
|
'array_array_of_integer' => 'int[][]',
|
||||||
|
'array_array_of_model' => '\Swagger\Client\Model\ReadOnlyFirst[][]'
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function swaggerTypes()
|
public static function swaggerTypes()
|
||||||
@ -78,7 +80,9 @@ class ArrayTest implements ArrayAccess
|
|||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected static $attributeMap = array(
|
protected static $attributeMap = array(
|
||||||
|
'array_of_string' => 'array_of_string',
|
||||||
|
'array_array_of_integer' => 'array_array_of_integer',
|
||||||
|
'array_array_of_model' => 'array_array_of_model'
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function attributeMap()
|
public static function attributeMap()
|
||||||
@ -91,7 +95,9 @@ class ArrayTest implements ArrayAccess
|
|||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected static $setters = array(
|
protected static $setters = array(
|
||||||
|
'array_of_string' => 'setArrayOfString',
|
||||||
|
'array_array_of_integer' => 'setArrayArrayOfInteger',
|
||||||
|
'array_array_of_model' => 'setArrayArrayOfModel'
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function setters()
|
public static function setters()
|
||||||
@ -104,7 +110,9 @@ class ArrayTest implements ArrayAccess
|
|||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
protected static $getters = array(
|
protected static $getters = array(
|
||||||
|
'array_of_string' => 'getArrayOfString',
|
||||||
|
'array_array_of_integer' => 'getArrayArrayOfInteger',
|
||||||
|
'array_array_of_model' => 'getArrayArrayOfModel'
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function getters()
|
public static function getters()
|
||||||
@ -128,6 +136,9 @@ class ArrayTest implements ArrayAccess
|
|||||||
*/
|
*/
|
||||||
public function __construct(array $data = null)
|
public function __construct(array $data = null)
|
||||||
{
|
{
|
||||||
|
$this->container['array_of_string'] = isset($data['array_of_string']) ? $data['array_of_string'] : null;
|
||||||
|
$this->container['array_array_of_integer'] = isset($data['array_array_of_integer']) ? $data['array_array_of_integer'] : null;
|
||||||
|
$this->container['array_array_of_model'] = isset($data['array_array_of_model']) ? $data['array_array_of_model'] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,6 +163,69 @@ class ArrayTest implements ArrayAccess
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets array_of_string
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function getArrayOfString()
|
||||||
|
{
|
||||||
|
return $this->container['array_of_string'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets array_of_string
|
||||||
|
* @param string[] $array_of_string
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setArrayOfString($array_of_string)
|
||||||
|
{
|
||||||
|
$this->container['array_of_string'] = $array_of_string;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets array_array_of_integer
|
||||||
|
* @return int[][]
|
||||||
|
*/
|
||||||
|
public function getArrayArrayOfInteger()
|
||||||
|
{
|
||||||
|
return $this->container['array_array_of_integer'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets array_array_of_integer
|
||||||
|
* @param int[][] $array_array_of_integer
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setArrayArrayOfInteger($array_array_of_integer)
|
||||||
|
{
|
||||||
|
$this->container['array_array_of_integer'] = $array_array_of_integer;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets array_array_of_model
|
||||||
|
* @return \Swagger\Client\Model\ReadOnlyFirst[][]
|
||||||
|
*/
|
||||||
|
public function getArrayArrayOfModel()
|
||||||
|
{
|
||||||
|
return $this->container['array_array_of_model'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets array_array_of_model
|
||||||
|
* @param \Swagger\Client\Model\ReadOnlyFirst[][] $array_array_of_model
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setArrayArrayOfModel($array_array_of_model)
|
||||||
|
{
|
||||||
|
$this->container['array_array_of_model'] = $array_array_of_model;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Returns true if offset exists. False otherwise.
|
* Returns true if offset exists. False otherwise.
|
||||||
* @param integer $offset Offset
|
* @param integer $offset Offset
|
||||||
|
@ -66,7 +66,8 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ArrayAccess
|
|||||||
*/
|
*/
|
||||||
protected static $swaggerTypes = array(
|
protected static $swaggerTypes = array(
|
||||||
'uuid' => 'string',
|
'uuid' => 'string',
|
||||||
'date_time' => '\DateTime'
|
'date_time' => '\DateTime',
|
||||||
|
'map' => 'map[string,\Swagger\Client\Model\Animal]'
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function swaggerTypes()
|
public static function swaggerTypes()
|
||||||
@ -80,7 +81,8 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ArrayAccess
|
|||||||
*/
|
*/
|
||||||
protected static $attributeMap = array(
|
protected static $attributeMap = array(
|
||||||
'uuid' => 'uuid',
|
'uuid' => 'uuid',
|
||||||
'date_time' => 'dateTime'
|
'date_time' => 'dateTime',
|
||||||
|
'map' => 'map'
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function attributeMap()
|
public static function attributeMap()
|
||||||
@ -94,7 +96,8 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ArrayAccess
|
|||||||
*/
|
*/
|
||||||
protected static $setters = array(
|
protected static $setters = array(
|
||||||
'uuid' => 'setUuid',
|
'uuid' => 'setUuid',
|
||||||
'date_time' => 'setDateTime'
|
'date_time' => 'setDateTime',
|
||||||
|
'map' => 'setMap'
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function setters()
|
public static function setters()
|
||||||
@ -108,7 +111,8 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ArrayAccess
|
|||||||
*/
|
*/
|
||||||
protected static $getters = array(
|
protected static $getters = array(
|
||||||
'uuid' => 'getUuid',
|
'uuid' => 'getUuid',
|
||||||
'date_time' => 'getDateTime'
|
'date_time' => 'getDateTime',
|
||||||
|
'map' => 'getMap'
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function getters()
|
public static function getters()
|
||||||
@ -134,6 +138,7 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ArrayAccess
|
|||||||
{
|
{
|
||||||
$this->container['uuid'] = isset($data['uuid']) ? $data['uuid'] : null;
|
$this->container['uuid'] = isset($data['uuid']) ? $data['uuid'] : null;
|
||||||
$this->container['date_time'] = isset($data['date_time']) ? $data['date_time'] : null;
|
$this->container['date_time'] = isset($data['date_time']) ? $data['date_time'] : null;
|
||||||
|
$this->container['map'] = isset($data['map']) ? $data['map'] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,6 +205,27 @@ class MixedPropertiesAndAdditionalPropertiesClass implements ArrayAccess
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets map
|
||||||
|
* @return map[string,\Swagger\Client\Model\Animal]
|
||||||
|
*/
|
||||||
|
public function getMap()
|
||||||
|
{
|
||||||
|
return $this->container['map'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets map
|
||||||
|
* @param map[string,\Swagger\Client\Model\Animal] $map
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setMap($map)
|
||||||
|
{
|
||||||
|
$this->container['map'] = $map;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Returns true if offset exists. False otherwise.
|
* Returns true if offset exists. False otherwise.
|
||||||
* @param integer $offset Offset
|
* @param integer $offset Offset
|
||||||
|
@ -66,4 +66,30 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertInternalType("int", $get_response['available']);
|
$this->assertInternalType("int", $get_response['available']);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test empty array response
|
||||||
|
*
|
||||||
|
* Make sure empty arrays from a producer is actually returned as
|
||||||
|
* an empty array and not some other value. At some point it was
|
||||||
|
* returned as null because the code stumbled on PHP loose type
|
||||||
|
* checking (not on empty array is true, same thing could happen
|
||||||
|
* with careless use of empty()).
|
||||||
|
*/
|
||||||
|
public function testEmptyArrayResponse()
|
||||||
|
{
|
||||||
|
// initialize the API client
|
||||||
|
$config = (new Configuration())->setHost('http://petstore.swagger.io/v2');
|
||||||
|
$apiClient = new ApiClient($config);
|
||||||
|
$storeApi = new Api\PetApi($apiClient);
|
||||||
|
// this call returns and empty array
|
||||||
|
$response = $storeApi->findPetsByStatus(array());
|
||||||
|
|
||||||
|
// make sure this is an array as we want it to be
|
||||||
|
$this->assertInternalType("array", $response);
|
||||||
|
|
||||||
|
// make sure the array is empty just in case the petstore
|
||||||
|
// server changes its output
|
||||||
|
$this->assertEmpty($response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user