forked from loafle/openapi-generator-original
minor php code improvement
This commit is contained in:
@@ -259,7 +259,7 @@ class ApiClient
|
||||
*
|
||||
* @return string Accept (e.g. application/json)
|
||||
*/
|
||||
public static function selectHeaderAccept($accept)
|
||||
public function selectHeaderAccept($accept)
|
||||
{
|
||||
if (count($accept) === 0 or (count($accept) === 1 and $accept[0] === '')) {
|
||||
return null;
|
||||
@@ -277,7 +277,7 @@ class ApiClient
|
||||
*
|
||||
* @return string Content-Type (e.g. application/json)
|
||||
*/
|
||||
public static function selectHeaderContentType($content_type)
|
||||
public function selectHeaderContentType($content_type)
|
||||
{
|
||||
if (count($content_type) === 0 or (count($content_type) === 1 and $content_type[0] === '')) {
|
||||
return 'application/json';
|
||||
@@ -299,9 +299,9 @@ class ApiClient
|
||||
{
|
||||
// ref/credit: http://php.net/manual/en/function.http-parse-headers.php#112986
|
||||
$headers = array();
|
||||
$key = ''; // [+]
|
||||
$key = '';
|
||||
|
||||
foreach(explode("\n", $raw_headers) as $i => $h)
|
||||
foreach(explode("\n", $raw_headers) as $h)
|
||||
{
|
||||
$h = explode(':', $h, 2);
|
||||
|
||||
@@ -311,26 +311,22 @@ class ApiClient
|
||||
$headers[$h[0]] = trim($h[1]);
|
||||
elseif (is_array($headers[$h[0]]))
|
||||
{
|
||||
// $tmp = array_merge($headers[$h[0]], array(trim($h[1]))); // [-]
|
||||
// $headers[$h[0]] = $tmp; // [-]
|
||||
$headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1]))); // [+]
|
||||
$headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1])));
|
||||
}
|
||||
else
|
||||
{
|
||||
// $tmp = array_merge(array($headers[$h[0]]), array(trim($h[1]))); // [-]
|
||||
// $headers[$h[0]] = $tmp; // [-]
|
||||
$headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1]))); // [+]
|
||||
$headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1])));
|
||||
}
|
||||
|
||||
$key = $h[0]; // [+]
|
||||
$key = $h[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (substr($h[0], 0, 1) == "\t")
|
||||
$headers[$key] .= "\r\n\t".trim($h[0]);
|
||||
elseif (!$key)
|
||||
$headers[0] = trim($h[0]);trim($h[0]);
|
||||
}
|
||||
else // [+]
|
||||
{ // [+]
|
||||
if (substr($h[0], 0, 1) == "\t") // [+]
|
||||
$headers[$key] .= "\r\n\t".trim($h[0]); // [+]
|
||||
elseif (!$key) // [+]
|
||||
$headers[0] = trim($h[0]);trim($h[0]); // [+]
|
||||
} // [+]
|
||||
}
|
||||
|
||||
return $headers;
|
||||
|
||||
@@ -55,14 +55,14 @@ class ObjectSerializer
|
||||
public static function sanitizeForSerialization($data)
|
||||
{
|
||||
if (is_scalar($data) || null === $data) {
|
||||
$sanitized = $data;
|
||||
return $data;
|
||||
} elseif ($data instanceof \DateTime) {
|
||||
$sanitized = $data->format(\DateTime::ATOM);
|
||||
return $data->format(\DateTime::ATOM);
|
||||
} elseif (is_array($data)) {
|
||||
foreach ($data as $property => $value) {
|
||||
$data[$property] = self::sanitizeForSerialization($value);
|
||||
}
|
||||
$sanitized = $data;
|
||||
return $data;
|
||||
} elseif (is_object($data)) {
|
||||
$values = array();
|
||||
foreach (array_keys($data::swaggerTypes()) as $property) {
|
||||
@@ -71,12 +71,10 @@ class ObjectSerializer
|
||||
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($data->$getter());
|
||||
}
|
||||
}
|
||||
$sanitized = (object)$values;
|
||||
return (object)$values;
|
||||
} else {
|
||||
$sanitized = (string)$data;
|
||||
return (string)$data;
|
||||
}
|
||||
|
||||
return $sanitized;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,7 +222,7 @@ class ObjectSerializer
|
||||
public static function deserialize($data, $class, $httpHeaders=null, $discriminator=null)
|
||||
{
|
||||
if (null === $data) {
|
||||
$deserialized = null;
|
||||
return null;
|
||||
} elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int]
|
||||
$inner = substr($class, 4, -1);
|
||||
$deserialized = array();
|
||||
@@ -235,16 +233,17 @@ class ObjectSerializer
|
||||
$deserialized[$key] = self::deserialize($value, $subClass, null, $discriminator);
|
||||
}
|
||||
}
|
||||
return $deserialized;
|
||||
} elseif (strcasecmp(substr($class, -2), '[]') == 0) {
|
||||
$subClass = substr($class, 0, -2);
|
||||
$values = array();
|
||||
foreach ($data as $key => $value) {
|
||||
$values[] = self::deserialize($value, $subClass, null, $discriminator);
|
||||
}
|
||||
$deserialized = $values;
|
||||
return $values;
|
||||
} elseif ($class === 'object') {
|
||||
settype($data, 'array');
|
||||
$deserialized = $data;
|
||||
return $data;
|
||||
} elseif ($class === '\DateTime') {
|
||||
// Some API's return an invalid, empty string as a
|
||||
// date-time property. DateTime::__construct() will return
|
||||
@@ -253,13 +252,13 @@ class ObjectSerializer
|
||||
// be interpreted as a missing field/value. Let's handle
|
||||
// this graceful.
|
||||
if (!empty($data)) {
|
||||
$deserialized = new \DateTime($data);
|
||||
return new \DateTime($data);
|
||||
} else {
|
||||
$deserialized = null;
|
||||
return null;
|
||||
}
|
||||
} elseif (in_array($class, array({{&primitives}}))) {
|
||||
settype($data, $class);
|
||||
$deserialized = $data;
|
||||
return $data;
|
||||
} elseif ($class === '\SplFileObject') {
|
||||
// determine file name
|
||||
if (array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) {
|
||||
@@ -270,6 +269,7 @@ class ObjectSerializer
|
||||
$deserialized = new \SplFileObject($filename, "w");
|
||||
$byte_written = $deserialized->fwrite($data);
|
||||
error_log("[INFO] Written $byte_written byte to $filename. Please move the file to a proper folder or delete the temp file after processing.\n", 3, Configuration::getDefaultConfiguration()->getDebugFile());
|
||||
return $deserialized;
|
||||
|
||||
} else {
|
||||
// If a discriminator is defined and points to a valid subclass, use it.
|
||||
@@ -292,9 +292,7 @@ class ObjectSerializer
|
||||
$instance->$propertySetter(self::deserialize($propertyValue, $type, null, $discriminator));
|
||||
}
|
||||
}
|
||||
$deserialized = $instance;
|
||||
}
|
||||
|
||||
return $deserialized;
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ use \{{invokerPackage}}\ObjectSerializer;
|
||||
*/
|
||||
public function {{operationId}}({{#allParams}}${{paramName}}{{^required}} = null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->{{operationId}}WithHttpInfo ({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
list($response) = $this->{{operationId}}WithHttpInfo ({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -130,11 +130,11 @@ use \{{invokerPackage}}\ObjectSerializer;
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array({{#produces}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/produces}}));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array({{#produces}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/produces}}));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array({{#consumes}}'{{mediaType}}'{{#hasMore}},{{/hasMore}}{{/consumes}}));
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array({{#consumes}}'{{mediaType}}'{{#hasMore}},{{/hasMore}}{{/consumes}}));
|
||||
|
||||
{{#queryParams}}// query params
|
||||
{{#collectionFormat}}
|
||||
@@ -223,14 +223,14 @@ use \{{invokerPackage}}\ObjectSerializer;
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\{{invokerPackage}}\ObjectSerializer::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}}
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
{{/returnType}}
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) { {{#responses}}{{#dataType}}
|
||||
{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}}
|
||||
$data = \{{invokerPackage}}\ObjectSerializer::deserialize($e->getResponseBody(), '{{dataType}}', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '{{dataType}}', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;{{/dataType}}{{/responses}}
|
||||
}
|
||||
|
||||
@@ -192,11 +192,11 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
return json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
|
||||
return json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
{{/model}}
|
||||
|
||||
@@ -3,9 +3,9 @@ This is a sample server Petstore server. You can find out more about Swagger at
|
||||
|
||||
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: 1.0.0
|
||||
- API verion: 1.0.0
|
||||
- Package version: 1.0.0
|
||||
- Build date: 2016-03-30T20:57:56.803+08:00
|
||||
- Build date: 2016-03-29T20:55:19.032+08:00
|
||||
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -102,7 +102,7 @@ class PetApi
|
||||
*/
|
||||
public function addPet($body = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->addPetWithHttpInfo ($body);
|
||||
list($response) = $this->addPetWithHttpInfo ($body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -126,11 +126,11 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json','application/xml'));
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/xml'));
|
||||
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ class PetApi
|
||||
*/
|
||||
public function addPetUsingByteArray($body = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->addPetUsingByteArrayWithHttpInfo ($body);
|
||||
list($response) = $this->addPetUsingByteArrayWithHttpInfo ($body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -210,11 +210,11 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json','application/xml'));
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/xml'));
|
||||
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ class PetApi
|
||||
*/
|
||||
public function deletePet($pet_id, $api_key = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->deletePetWithHttpInfo ($pet_id, $api_key);
|
||||
list($response) = $this->deletePetWithHttpInfo ($pet_id, $api_key);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -300,11 +300,11 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
// header params
|
||||
@@ -368,7 +368,7 @@ class PetApi
|
||||
*/
|
||||
public function findPetsByStatus($status = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->findPetsByStatusWithHttpInfo ($status);
|
||||
list($response) = $this->findPetsByStatusWithHttpInfo ($status);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -392,11 +392,11 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
// query params
|
||||
|
||||
@@ -439,12 +439,12 @@ class PetApi
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::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) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet[]', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet[]', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@@ -464,7 +464,7 @@ class PetApi
|
||||
*/
|
||||
public function findPetsByTags($tags = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->findPetsByTagsWithHttpInfo ($tags);
|
||||
list($response) = $this->findPetsByTagsWithHttpInfo ($tags);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -488,11 +488,11 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
// query params
|
||||
|
||||
@@ -535,12 +535,12 @@ class PetApi
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::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) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet[]', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet[]', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@@ -560,7 +560,7 @@ class PetApi
|
||||
*/
|
||||
public function getPetById($pet_id)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->getPetByIdWithHttpInfo ($pet_id);
|
||||
list($response) = $this->getPetByIdWithHttpInfo ($pet_id);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -588,11 +588,11 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@@ -642,12 +642,12 @@ class PetApi
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::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) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@@ -667,7 +667,7 @@ class PetApi
|
||||
*/
|
||||
public function getPetByIdInObject($pet_id)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->getPetByIdInObjectWithHttpInfo ($pet_id);
|
||||
list($response) = $this->getPetByIdInObjectWithHttpInfo ($pet_id);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -695,11 +695,11 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@@ -749,12 +749,12 @@ class PetApi
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\InlineResponse200', $httpHeader), $statusCode, $httpHeader);
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\InlineResponse200', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\InlineResponse200', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\InlineResponse200', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@@ -774,7 +774,7 @@ class PetApi
|
||||
*/
|
||||
public function petPetIdtestingByteArraytrueGet($pet_id)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->petPetIdtestingByteArraytrueGetWithHttpInfo ($pet_id);
|
||||
list($response) = $this->petPetIdtestingByteArraytrueGetWithHttpInfo ($pet_id);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -802,11 +802,11 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@@ -856,12 +856,12 @@ class PetApi
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader);
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), 'string', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'string', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@@ -881,7 +881,7 @@ class PetApi
|
||||
*/
|
||||
public function updatePet($body = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->updatePetWithHttpInfo ($body);
|
||||
list($response) = $this->updatePetWithHttpInfo ($body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -905,11 +905,11 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json','application/xml'));
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/xml'));
|
||||
|
||||
|
||||
|
||||
@@ -967,7 +967,7 @@ class PetApi
|
||||
*/
|
||||
public function updatePetWithForm($pet_id, $name = null, $status = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->updatePetWithFormWithHttpInfo ($pet_id, $name, $status);
|
||||
list($response) = $this->updatePetWithFormWithHttpInfo ($pet_id, $name, $status);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -997,11 +997,11 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/x-www-form-urlencoded'));
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/x-www-form-urlencoded'));
|
||||
|
||||
|
||||
|
||||
@@ -1075,7 +1075,7 @@ class PetApi
|
||||
*/
|
||||
public function uploadFile($pet_id, $additional_metadata = null, $file = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->uploadFileWithHttpInfo ($pet_id, $additional_metadata, $file);
|
||||
list($response) = $this->uploadFileWithHttpInfo ($pet_id, $additional_metadata, $file);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -1105,11 +1105,11 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('multipart/form-data'));
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('multipart/form-data'));
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ class StoreApi
|
||||
*/
|
||||
public function deleteOrder($order_id)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->deleteOrderWithHttpInfo ($order_id);
|
||||
list($response) = $this->deleteOrderWithHttpInfo ($order_id);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -130,11 +130,11 @@ class StoreApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ class StoreApi
|
||||
*/
|
||||
public function findOrdersByStatus($status = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->findOrdersByStatusWithHttpInfo ($status);
|
||||
list($response) = $this->findOrdersByStatusWithHttpInfo ($status);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -213,11 +213,11 @@ class StoreApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
// query params
|
||||
|
||||
@@ -265,12 +265,12 @@ class StoreApi
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::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) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order[]', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order[]', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@@ -289,7 +289,7 @@ class StoreApi
|
||||
*/
|
||||
public function getInventory()
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->getInventoryWithHttpInfo ();
|
||||
list($response) = $this->getInventoryWithHttpInfo ();
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -312,11 +312,11 @@ class StoreApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@@ -353,12 +353,12 @@ class StoreApi
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, 'map[string,int]', $httpHeader), $statusCode, $httpHeader);
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, 'map[string,int]', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), 'map[string,int]', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'map[string,int]', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@@ -377,7 +377,7 @@ class StoreApi
|
||||
*/
|
||||
public function getInventoryInObject()
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->getInventoryInObjectWithHttpInfo ();
|
||||
list($response) = $this->getInventoryInObjectWithHttpInfo ();
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -400,11 +400,11 @@ class StoreApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@@ -441,12 +441,12 @@ class StoreApi
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, 'object', $httpHeader), $statusCode, $httpHeader);
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, 'object', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), 'object', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'object', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@@ -466,7 +466,7 @@ class StoreApi
|
||||
*/
|
||||
public function getOrderById($order_id)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->getOrderByIdWithHttpInfo ($order_id);
|
||||
list($response) = $this->getOrderByIdWithHttpInfo ($order_id);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -494,11 +494,11 @@ class StoreApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@@ -550,12 +550,12 @@ class StoreApi
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::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) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@@ -575,7 +575,7 @@ class StoreApi
|
||||
*/
|
||||
public function placeOrder($body = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->placeOrderWithHttpInfo ($body);
|
||||
list($response) = $this->placeOrderWithHttpInfo ($body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -599,11 +599,11 @@ class StoreApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@@ -651,12 +651,12 @@ class StoreApi
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::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) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ class UserApi
|
||||
*/
|
||||
public function createUser($body = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->createUserWithHttpInfo ($body);
|
||||
list($response) = $this->createUserWithHttpInfo ($body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -126,11 +126,11 @@ class UserApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ class UserApi
|
||||
*/
|
||||
public function createUsersWithArrayInput($body = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->createUsersWithArrayInputWithHttpInfo ($body);
|
||||
list($response) = $this->createUsersWithArrayInputWithHttpInfo ($body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -205,11 +205,11 @@ class UserApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@@ -260,7 +260,7 @@ class UserApi
|
||||
*/
|
||||
public function createUsersWithListInput($body = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->createUsersWithListInputWithHttpInfo ($body);
|
||||
list($response) = $this->createUsersWithListInputWithHttpInfo ($body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -284,11 +284,11 @@ class UserApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@@ -339,7 +339,7 @@ class UserApi
|
||||
*/
|
||||
public function deleteUser($username)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->deleteUserWithHttpInfo ($username);
|
||||
list($response) = $this->deleteUserWithHttpInfo ($username);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -367,11 +367,11 @@ class UserApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@@ -431,7 +431,7 @@ class UserApi
|
||||
*/
|
||||
public function getUserByName($username)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->getUserByNameWithHttpInfo ($username);
|
||||
list($response) = $this->getUserByNameWithHttpInfo ($username);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -459,11 +459,11 @@ class UserApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@@ -501,12 +501,12 @@ class UserApi
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::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) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\User', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\User', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@@ -527,7 +527,7 @@ class UserApi
|
||||
*/
|
||||
public function loginUser($username = null, $password = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->loginUserWithHttpInfo ($username, $password);
|
||||
list($response) = $this->loginUserWithHttpInfo ($username, $password);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -552,11 +552,11 @@ class UserApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
// query params
|
||||
|
||||
@@ -594,12 +594,12 @@ class UserApi
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader);
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), 'string', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'string', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@@ -618,7 +618,7 @@ class UserApi
|
||||
*/
|
||||
public function logoutUser()
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->logoutUserWithHttpInfo ();
|
||||
list($response) = $this->logoutUserWithHttpInfo ();
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -641,11 +641,11 @@ class UserApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@@ -693,7 +693,7 @@ class UserApi
|
||||
*/
|
||||
public function updateUser($username, $body = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->updateUserWithHttpInfo ($username, $body);
|
||||
list($response) = $this->updateUserWithHttpInfo ($username, $body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -722,11 +722,11 @@ class UserApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ class ApiClient
|
||||
*
|
||||
* @return string Accept (e.g. application/json)
|
||||
*/
|
||||
public static function selectHeaderAccept($accept)
|
||||
public function selectHeaderAccept($accept)
|
||||
{
|
||||
if (count($accept) === 0 or (count($accept) === 1 and $accept[0] === '')) {
|
||||
return null;
|
||||
@@ -277,7 +277,7 @@ class ApiClient
|
||||
*
|
||||
* @return string Content-Type (e.g. application/json)
|
||||
*/
|
||||
public static function selectHeaderContentType($content_type)
|
||||
public function selectHeaderContentType($content_type)
|
||||
{
|
||||
if (count($content_type) === 0 or (count($content_type) === 1 and $content_type[0] === '')) {
|
||||
return 'application/json';
|
||||
@@ -299,9 +299,9 @@ class ApiClient
|
||||
{
|
||||
// ref/credit: http://php.net/manual/en/function.http-parse-headers.php#112986
|
||||
$headers = array();
|
||||
$key = ''; // [+]
|
||||
$key = '';
|
||||
|
||||
foreach(explode("\n", $raw_headers) as $i => $h)
|
||||
foreach(explode("\n", $raw_headers) as $h)
|
||||
{
|
||||
$h = explode(':', $h, 2);
|
||||
|
||||
@@ -311,26 +311,22 @@ class ApiClient
|
||||
$headers[$h[0]] = trim($h[1]);
|
||||
elseif (is_array($headers[$h[0]]))
|
||||
{
|
||||
// $tmp = array_merge($headers[$h[0]], array(trim($h[1]))); // [-]
|
||||
// $headers[$h[0]] = $tmp; // [-]
|
||||
$headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1]))); // [+]
|
||||
$headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1])));
|
||||
}
|
||||
else
|
||||
{
|
||||
// $tmp = array_merge(array($headers[$h[0]]), array(trim($h[1]))); // [-]
|
||||
// $headers[$h[0]] = $tmp; // [-]
|
||||
$headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1]))); // [+]
|
||||
$headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1])));
|
||||
}
|
||||
|
||||
$key = $h[0]; // [+]
|
||||
$key = $h[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (substr($h[0], 0, 1) == "\t")
|
||||
$headers[$key] .= "\r\n\t".trim($h[0]);
|
||||
elseif (!$key)
|
||||
$headers[0] = trim($h[0]);trim($h[0]);
|
||||
}
|
||||
else // [+]
|
||||
{ // [+]
|
||||
if (substr($h[0], 0, 1) == "\t") // [+]
|
||||
$headers[$key] .= "\r\n\t".trim($h[0]); // [+]
|
||||
elseif (!$key) // [+]
|
||||
$headers[0] = trim($h[0]);trim($h[0]); // [+]
|
||||
} // [+]
|
||||
}
|
||||
|
||||
return $headers;
|
||||
|
||||
@@ -182,10 +182,10 @@ class Animal implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,10 +182,10 @@ class Cat extends Animal implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,10 +214,10 @@ class Category implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,10 +182,10 @@ class Dog extends Animal implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,10 +345,10 @@ class InlineResponse200 implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,10 +182,10 @@ class Model200Response implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,10 +182,10 @@ class ModelReturn implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,10 +214,10 @@ class Name implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,10 +345,10 @@ class Order implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,10 +345,10 @@ class Pet implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,10 +182,10 @@ class SpecialModelName implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,10 +214,10 @@ class Tag implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,10 +406,10 @@ class User implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,14 +55,14 @@ class ObjectSerializer
|
||||
public static function sanitizeForSerialization($data)
|
||||
{
|
||||
if (is_scalar($data) || null === $data) {
|
||||
$sanitized = $data;
|
||||
return $data;
|
||||
} elseif ($data instanceof \DateTime) {
|
||||
$sanitized = $data->format(\DateTime::ATOM);
|
||||
return $data->format(\DateTime::ATOM);
|
||||
} elseif (is_array($data)) {
|
||||
foreach ($data as $property => $value) {
|
||||
$data[$property] = self::sanitizeForSerialization($value);
|
||||
}
|
||||
$sanitized = $data;
|
||||
return $data;
|
||||
} elseif (is_object($data)) {
|
||||
$values = array();
|
||||
foreach (array_keys($data::swaggerTypes()) as $property) {
|
||||
@@ -71,12 +71,10 @@ class ObjectSerializer
|
||||
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($data->$getter());
|
||||
}
|
||||
}
|
||||
$sanitized = (object)$values;
|
||||
return (object)$values;
|
||||
} else {
|
||||
$sanitized = (string)$data;
|
||||
return (string)$data;
|
||||
}
|
||||
|
||||
return $sanitized;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,7 +222,7 @@ class ObjectSerializer
|
||||
public static function deserialize($data, $class, $httpHeaders=null, $discriminator=null)
|
||||
{
|
||||
if (null === $data) {
|
||||
$deserialized = null;
|
||||
return null;
|
||||
} elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int]
|
||||
$inner = substr($class, 4, -1);
|
||||
$deserialized = array();
|
||||
@@ -235,16 +233,17 @@ class ObjectSerializer
|
||||
$deserialized[$key] = self::deserialize($value, $subClass, null, $discriminator);
|
||||
}
|
||||
}
|
||||
return $deserialized;
|
||||
} elseif (strcasecmp(substr($class, -2), '[]') == 0) {
|
||||
$subClass = substr($class, 0, -2);
|
||||
$values = array();
|
||||
foreach ($data as $key => $value) {
|
||||
$values[] = self::deserialize($value, $subClass, null, $discriminator);
|
||||
}
|
||||
$deserialized = $values;
|
||||
return $values;
|
||||
} elseif ($class === 'object') {
|
||||
settype($data, 'array');
|
||||
$deserialized = $data;
|
||||
return $data;
|
||||
} elseif ($class === '\DateTime') {
|
||||
// Some API's return an invalid, empty string as a
|
||||
// date-time property. DateTime::__construct() will return
|
||||
@@ -253,13 +252,13 @@ class ObjectSerializer
|
||||
// be interpreted as a missing field/value. Let's handle
|
||||
// this graceful.
|
||||
if (!empty($data)) {
|
||||
$deserialized = new \DateTime($data);
|
||||
return new \DateTime($data);
|
||||
} else {
|
||||
$deserialized = null;
|
||||
return null;
|
||||
}
|
||||
} elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) {
|
||||
settype($data, $class);
|
||||
$deserialized = $data;
|
||||
return $data;
|
||||
} elseif ($class === '\SplFileObject') {
|
||||
// determine file name
|
||||
if (array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) {
|
||||
@@ -270,6 +269,7 @@ class ObjectSerializer
|
||||
$deserialized = new \SplFileObject($filename, "w");
|
||||
$byte_written = $deserialized->fwrite($data);
|
||||
error_log("[INFO] Written $byte_written byte to $filename. Please move the file to a proper folder or delete the temp file after processing.\n", 3, Configuration::getDefaultConfiguration()->getDebugFile());
|
||||
return $deserialized;
|
||||
|
||||
} else {
|
||||
// If a discriminator is defined and points to a valid subclass, use it.
|
||||
@@ -292,9 +292,7 @@ class ObjectSerializer
|
||||
$instance->$propertySetter(self::deserialize($propertyValue, $type, null, $discriminator));
|
||||
}
|
||||
}
|
||||
$deserialized = $instance;
|
||||
}
|
||||
|
||||
return $deserialized;
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user