Regenerated PHP petstore sample.

This commit is contained in:
Arne Jørgensen 2015-10-27 22:58:25 +01:00
parent d907822fa9
commit 47b2ae934b
5 changed files with 163 additions and 105 deletions

View File

@ -431,9 +431,6 @@ class PetApi
//TODO support oauth
// make the API Call // make the API Call
try try
{ {
@ -509,10 +506,16 @@ class PetApi
} }
// form params // form params
if ($name !== null) { if ($name !== null) {
$formParams['name'] = $this->apiClient->getSerializer()->toFormValue($name); $formParams['name'] = $this->apiClient->getSerializer()->toFormValue($name);
}// form params }// form params
if ($status !== null) { if ($status !== null) {
$formParams['status'] = $this->apiClient->getSerializer()->toFormValue($status); $formParams['status'] = $this->apiClient->getSerializer()->toFormValue($status);
} }
@ -665,10 +668,22 @@ class PetApi
} }
// form params // form params
if ($additional_metadata !== null) { if ($additional_metadata !== null) {
$formParams['additionalMetadata'] = $this->apiClient->getSerializer()->toFormValue($additional_metadata); $formParams['additionalMetadata'] = $this->apiClient->getSerializer()->toFormValue($additional_metadata);
}// form params }// form params
if ($file !== null) { if ($file !== null) {
$formParams['file'] = '@' . $this->apiClient->getSerializer()->toFormValue($file);
// PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax
// See: https://wiki.php.net/rfc/curl-file-upload
if (function_exists('curl_file_create')) {
$formParams['file'] = curl_file_create($this->apiClient->getSerializer()->toFormValue($file));
} else {
$formParams['file'] = '@' . $this->apiClient->getSerializer()->toFormValue($file);
}
} }

View File

@ -1,11 +1,11 @@
<?php <?php
/** /**
* ApiClient * ApiClient
* *
* PHP version 5 * PHP version 5
* *
* @category Class * @category Class
* @package Swagger\Client * @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen * @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen * @link https://github.com/swagger-api/swagger-codegen
@ -26,8 +26,8 @@
* limitations under the License. * limitations under the License.
*/ */
/** /**
* NOTE: This class is auto generated by the swagger code generator program. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen * https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually. * Do not edit the class manually.
*/ */
@ -37,7 +37,7 @@ namespace Swagger\Client;
* ApiClient Class Doc Comment * ApiClient Class Doc Comment
* *
* @category Class * @category Class
* @package Swagger\Client * @package Swagger\Client
* @author http://github.com/swagger-api/swagger-codegen * @author http://github.com/swagger-api/swagger-codegen
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
* @link https://github.com/swagger-api/swagger-codegen * @link https://github.com/swagger-api/swagger-codegen
@ -52,19 +52,19 @@ class ApiClient
public static $OPTIONS = "OPTIONS"; public static $OPTIONS = "OPTIONS";
public static $PUT = "PUT"; public static $PUT = "PUT";
public static $DELETE = "DELETE"; public static $DELETE = "DELETE";
/** /**
* Configuration * Configuration
* @var Configuration * @var Configuration
*/ */
protected $config; protected $config;
/** /**
* Object Serializer * Object Serializer
* @var ObjectSerializer * @var ObjectSerializer
*/ */
protected $serializer; protected $serializer;
/** /**
* Constructor of the class * Constructor of the class
* @param Configuration $config config for this ApiClient * @param Configuration $config config for this ApiClient
@ -74,11 +74,11 @@ class ApiClient
if ($config == null) { if ($config == null) {
$config = Configuration::getDefaultConfiguration(); $config = Configuration::getDefaultConfiguration();
} }
$this->config = $config; $this->config = $config;
$this->serializer = new ObjectSerializer(); $this->serializer = new ObjectSerializer();
} }
/** /**
* Get the config * Get the config
* @return Configuration * @return Configuration
@ -87,7 +87,7 @@ class ApiClient
{ {
return $this->config; return $this->config;
} }
/** /**
* Get the serializer * Get the serializer
* @return ObjectSerializer * @return ObjectSerializer
@ -96,7 +96,7 @@ class ApiClient
{ {
return $this->serializer; return $this->serializer;
} }
/** /**
* Get API key (with prefix if set) * Get API key (with prefix if set)
* @param string $apiKeyIdentifier name of apikey * @param string $apiKeyIdentifier name of apikey
@ -106,20 +106,20 @@ class ApiClient
{ {
$prefix = $this->config->getApiKeyPrefix($apiKeyIdentifier); $prefix = $this->config->getApiKeyPrefix($apiKeyIdentifier);
$apiKey = $this->config->getApiKey($apiKeyIdentifier); $apiKey = $this->config->getApiKey($apiKeyIdentifier);
if (!isset($apiKey)) { if (!isset($apiKey)) {
return null; return null;
} }
if (isset($prefix)) { if (isset($prefix)) {
$keyWithPrefix = $prefix." ".$apiKey; $keyWithPrefix = $prefix." ".$apiKey;
} else { } else {
$keyWithPrefix = $apiKey; $keyWithPrefix = $apiKey;
} }
return $keyWithPrefix; return $keyWithPrefix;
} }
/** /**
* Make the HTTP call (Sync) * Make the HTTP call (Sync)
* @param string $resourcePath path to method endpoint * @param string $resourcePath path to method endpoint
@ -133,28 +133,28 @@ class ApiClient
*/ */
public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType=null) public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType=null)
{ {
$headers = array(); $headers = array();
// construct the http header // construct the http header
$headerParams = array_merge( $headerParams = array_merge(
(array)$this->config->getDefaultHeaders(), (array)$this->config->getDefaultHeaders(),
(array)$headerParams (array)$headerParams
); );
foreach ($headerParams as $key => $val) { foreach ($headerParams as $key => $val) {
$headers[] = "$key: $val"; $headers[] = "$key: $val";
} }
// form data // form data
if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers)) { if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers)) {
$postData = http_build_query($postData); $postData = http_build_query($postData);
} else if ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers)) { // json model } else if ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers)) { // json model
$postData = json_encode($this->serializer->sanitizeForSerialization($postData)); $postData = json_encode($this->serializer->sanitizeForSerialization($postData));
} }
$url = $this->config->getHost() . $resourcePath; $url = $this->config->getHost() . $resourcePath;
$curl = curl_init(); $curl = curl_init();
// set timeout, if needed // set timeout, if needed
if ($this->config->getCurlTimeout() != 0) { if ($this->config->getCurlTimeout() != 0) {
@ -162,13 +162,19 @@ class ApiClient
} }
// return the result on success, rather than just TRUE // return the result on success, rather than just TRUE
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
// disable SSL verification, if needed
if ($this->config->getSSLVerification() == false) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
}
if (! empty($queryParams)) { if (! empty($queryParams)) {
$url = ($url . '?' . http_build_query($queryParams)); $url = ($url . '?' . http_build_query($queryParams));
} }
if ($method == self::$POST) { if ($method == self::$POST) {
curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
@ -190,57 +196,62 @@ class ApiClient
throw new ApiException('Method ' . $method . ' is not recognized.'); throw new ApiException('Method ' . $method . ' is not recognized.');
} }
curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_URL, $url);
// Set user agent // Set user agent
curl_setopt($curl, CURLOPT_USERAGENT, $this->config->getUserAgent()); curl_setopt($curl, CURLOPT_USERAGENT, $this->config->getUserAgent());
// debugging for curl // debugging for curl
if ($this->config->getDebug()) { if ($this->config->getDebug()) {
error_log("[DEBUG] HTTP Request body ~BEGIN~\n".print_r($postData, true)."\n~END~\n", 3, $this->config->getDebugFile()); error_log("[DEBUG] HTTP Request body ~BEGIN~\n".print_r($postData, true)."\n~END~\n", 3, $this->config->getDebugFile());
curl_setopt($curl, CURLOPT_VERBOSE, 1); curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_STDERR, fopen($this->config->getDebugFile(), 'a')); curl_setopt($curl, CURLOPT_STDERR, fopen($this->config->getDebugFile(), 'a'));
} else { } else {
curl_setopt($curl, CURLOPT_VERBOSE, 0); curl_setopt($curl, CURLOPT_VERBOSE, 0);
} }
// obtain the HTTP response headers // obtain the HTTP response headers
curl_setopt($curl, CURLOPT_HEADER, 1); curl_setopt($curl, CURLOPT_HEADER, 1);
// Make the request // Make the request
$response = curl_exec($curl); $response = curl_exec($curl);
$http_header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE); $http_header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
$http_header = substr($response, 0, $http_header_size); $http_header = substr($response, 0, $http_header_size);
$http_body = substr($response, $http_header_size); $http_body = substr($response, $http_header_size);
$response_info = curl_getinfo($curl); $response_info = curl_getinfo($curl);
// debug HTTP response body // debug HTTP response body
if ($this->config->getDebug()) { if ($this->config->getDebug()) {
error_log("[DEBUG] HTTP Response body ~BEGIN~\n".print_r($http_body, true)."\n~END~\n", 3, $this->config->getDebugFile()); error_log("[DEBUG] HTTP Response body ~BEGIN~\n".print_r($http_body, true)."\n~END~\n", 3, $this->config->getDebugFile());
} }
// Handle the response // Handle the response
if ($response_info['http_code'] == 0) { if ($response_info['http_code'] == 0) {
throw new ApiException("API call to $url timed out: ".serialize($response_info), 0, null, null); throw new ApiException("API call to $url timed out: ".serialize($response_info), 0, null, null);
} else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) { } else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) {
// return raw body if response is a file // return raw body if response is a file
if ($responseType == '\SplFileObject') { if ($responseType == '\SplFileObject') {
return array($http_body, $http_header); return array($http_body, $http_header);
} }
$data = json_decode($http_body); $data = json_decode($http_body);
if (json_last_error() > 0) { // if response is a string if (json_last_error() > 0) { // if response is a string
$data = $http_body; $data = $http_body;
} }
} else { } else {
$data = json_decode($http_body);
if (json_last_error() > 0) { // if response is a string
$data = $http_body;
}
throw new ApiException( throw new ApiException(
"[".$response_info['http_code']."] Error connecting to the API ($url)", "[".$response_info['http_code']."] Error connecting to the API ($url)",
$response_info['http_code'], $http_header, $http_body $response_info['http_code'], $http_header, $data
); );
} }
return array($data, $http_header); return array($data, $http_header);
} }
/** /**
* Return the header 'Accept' based on an array of Accept provided * Return the header 'Accept' based on an array of Accept provided
* *
@ -258,7 +269,7 @@ class ApiClient
return implode(',', $accept); return implode(',', $accept);
} }
} }
/** /**
* Return the content type based on an array of content-type provided * Return the content type based on an array of content-type provided
* *

View File

@ -46,30 +46,30 @@ use \Exception;
class ApiException extends Exception class ApiException extends Exception
{ {
/** /**
* The HTTP body of the server response. * The HTTP body of the server response either as Json or string.
* @var string * @var mixed
*/ */
protected $responseBody; protected $responseBody;
/** /**
* The HTTP header of the server response. * The HTTP header of the server response.
* @var string[] * @var string[]
*/ */
protected $responseHeaders; protected $responseHeaders;
/** /**
* The deserialized response object * The deserialized response object
* @var $responseObject; * @var $responseObject;
*/ */
protected $responseObject; protected $responseObject;
/** /**
* Constructor * Constructor
* @param string $message Error message * @param string $message Error message
* @param string $code HTTP status code * @param int $code HTTP status code
* @param string $responseHeaders HTTP response header * @param string $responseHeaders HTTP response header
* @param string $responseBody Deseralized response object * @param mixed $responseBody HTTP body of the server response either as Json or string
*/ */
public function __construct($message="", $code=0, $responseHeaders=null, $responseBody=null) public function __construct($message="", $code=0, $responseHeaders=null, $responseBody=null)
{ {
@ -77,7 +77,7 @@ class ApiException extends Exception
$this->responseHeaders = $responseHeaders; $this->responseHeaders = $responseHeaders;
$this->responseBody = $responseBody; $this->responseBody = $responseBody;
} }
/** /**
* Gets the HTTP response header * Gets the HTTP response header
* *
@ -87,17 +87,17 @@ class ApiException extends Exception
{ {
return $this->responseHeaders; return $this->responseHeaders;
} }
/** /**
* Gets the HTTP response body * Gets the HTTP body of the server response either as Json or string
* *
* @return string HTTP response body * @return mixed HTTP body of the server response either as Json or string
*/ */
public function getResponseBody() public function getResponseBody()
{ {
return $this->responseBody; return $this->responseBody;
} }
/** /**
* Sets the deseralized response object (during deserialization) * Sets the deseralized response object (during deserialization)
* @param mixed $obj Deserialized response object * @param mixed $obj Deserialized response object

View File

@ -27,8 +27,8 @@
*/ */
/** /**
* NOTE: This class is auto generated by the swagger code generator program. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen * https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually. * Do not edit the class manually.
*/ */
@ -48,70 +48,70 @@ class Configuration
{ {
private static $_defaultConfiguration = null; private static $_defaultConfiguration = null;
/** /**
* Associate array to store API key(s) * Associate array to store API key(s)
* *
* @var string[] * @var string[]
*/ */
protected $apiKeys = array(); protected $apiKeys = array();
/** /**
* Associate array to store API prefix (e.g. Bearer) * Associate array to store API prefix (e.g. Bearer)
* *
* @var string[] * @var string[]
*/ */
protected $apiKeyPrefixes = array(); protected $apiKeyPrefixes = array();
/** /**
* Username for HTTP basic authentication * Username for HTTP basic authentication
* *
* @var string * @var string
*/ */
protected $username = ''; protected $username = '';
/** /**
* Password for HTTP basic authentication * Password for HTTP basic authentication
* *
* @var string * @var string
*/ */
protected $password = ''; protected $password = '';
/** /**
* The default instance of ApiClient * The default instance of ApiClient
* *
* @var \Swagger\Client\ApiClient * @var \Swagger\Client\ApiClient
*/ */
protected $defaultHeaders = array(); protected $defaultHeaders = array();
/** /**
* The host * The host
* *
* @var string * @var string
*/ */
protected $host = 'http://petstore.swagger.io/v2'; protected $host = 'http://petstore.swagger.io/v2';
/** /**
* Timeout (second) of the HTTP request, by default set to 0, no timeout * Timeout (second) of the HTTP request, by default set to 0, no timeout
* *
* @var string * @var string
*/ */
protected $curlTimeout = 0; protected $curlTimeout = 0;
/** /**
* User agent of the HTTP request, set to "PHP-Swagger" by default * User agent of the HTTP request, set to "PHP-Swagger" by default
* *
* @var string * @var string
*/ */
protected $userAgent = "PHP-Swagger/1.0.0"; protected $userAgent = "PHP-Swagger/1.0.0";
/** /**
* Debug switch (default set to false) * Debug switch (default set to false)
* *
* @var bool * @var bool
*/ */
protected $debug = false; protected $debug = false;
/** /**
* Debug file location (log to STDOUT by default) * Debug file location (log to STDOUT by default)
* *
@ -126,6 +126,15 @@ class Configuration
*/ */
protected $tempFolderPath; protected $tempFolderPath;
/**
* Indicates if SSL verification should be enabled or disabled.
*
* This is useful if the host uses a self-signed SSL certificate.
*
* @var boolean True if the certificate should be validated, false otherwise.
*/
protected $sslVerification = true;
/** /**
* Constructor * Constructor
*/ */
@ -133,7 +142,7 @@ class Configuration
{ {
$this->tempFolderPath = sys_get_temp_dir(); $this->tempFolderPath = sys_get_temp_dir();
} }
/** /**
* Sets API key * Sets API key
* *
@ -147,7 +156,7 @@ class Configuration
$this->apiKeys[$apiKeyIdentifier] = $key; $this->apiKeys[$apiKeyIdentifier] = $key;
return $this; return $this;
} }
/** /**
* Gets API key * Gets API key
* *
@ -159,7 +168,7 @@ class Configuration
{ {
return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null;
} }
/** /**
* Sets the prefix for API key (e.g. Bearer) * Sets the prefix for API key (e.g. Bearer)
* *
@ -173,7 +182,7 @@ class Configuration
$this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix;
return $this; return $this;
} }
/** /**
* Gets API key prefix * Gets API key prefix
* *
@ -185,7 +194,7 @@ class Configuration
{ {
return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null;
} }
/** /**
* Sets the username for HTTP basic authentication * Sets the username for HTTP basic authentication
* *
@ -198,7 +207,7 @@ class Configuration
$this->username = $username; $this->username = $username;
return $this; return $this;
} }
/** /**
* Gets the username for HTTP basic authentication * Gets the username for HTTP basic authentication
* *
@ -208,7 +217,7 @@ class Configuration
{ {
return $this->username; return $this->username;
} }
/** /**
* Sets the password for HTTP basic authentication * Sets the password for HTTP basic authentication
* *
@ -221,7 +230,7 @@ class Configuration
$this->password = $password; $this->password = $password;
return $this; return $this;
} }
/** /**
* Gets the password for HTTP basic authentication * Gets the password for HTTP basic authentication
* *
@ -231,7 +240,7 @@ class Configuration
{ {
return $this->password; return $this->password;
} }
/** /**
* Adds a default header * Adds a default header
* *
@ -245,11 +254,11 @@ class Configuration
if (!is_string($headerName)) { if (!is_string($headerName)) {
throw new \InvalidArgumentException('Header name must be a string.'); throw new \InvalidArgumentException('Header name must be a string.');
} }
$this->defaultHeaders[$headerName] = $headerValue; $this->defaultHeaders[$headerName] = $headerValue;
return $this; return $this;
} }
/** /**
* Gets the default header * Gets the default header
* *
@ -259,7 +268,7 @@ class Configuration
{ {
return $this->defaultHeaders; return $this->defaultHeaders;
} }
/** /**
* Deletes a default header * Deletes a default header
* *
@ -271,7 +280,7 @@ class Configuration
{ {
unset($this->defaultHeaders[$headerName]); unset($this->defaultHeaders[$headerName]);
} }
/** /**
* Sets the host * Sets the host
* *
@ -284,7 +293,7 @@ class Configuration
$this->host = $host; $this->host = $host;
return $this; return $this;
} }
/** /**
* Gets the host * Gets the host
* *
@ -294,7 +303,7 @@ class Configuration
{ {
return $this->host; return $this->host;
} }
/** /**
* Sets the user agent of the api client * Sets the user agent of the api client
* *
@ -307,11 +316,11 @@ class Configuration
if (!is_string($userAgent)) { if (!is_string($userAgent)) {
throw new \InvalidArgumentException('User-agent must be a string.'); throw new \InvalidArgumentException('User-agent must be a string.');
} }
$this->userAgent = $userAgent; $this->userAgent = $userAgent;
return $this; return $this;
} }
/** /**
* Gets the user agent of the api client * Gets the user agent of the api client
* *
@ -321,7 +330,7 @@ class Configuration
{ {
return $this->userAgent; return $this->userAgent;
} }
/** /**
* Sets the HTTP timeout value * Sets the HTTP timeout value
* *
@ -334,11 +343,11 @@ class Configuration
if (!is_numeric($seconds) || $seconds < 0) { if (!is_numeric($seconds) || $seconds < 0) {
throw new \InvalidArgumentException('Timeout value must be numeric and a non-negative number.'); throw new \InvalidArgumentException('Timeout value must be numeric and a non-negative number.');
} }
$this->curlTimeout = $seconds; $this->curlTimeout = $seconds;
return $this; return $this;
} }
/** /**
* Gets the HTTP timeout value * Gets the HTTP timeout value
* *
@ -348,10 +357,10 @@ class Configuration
{ {
return $this->curlTimeout; return $this->curlTimeout;
} }
/** /**
* Sets debug flag * Sets debug flag
* *
* @param bool $debug Debug flag * @param bool $debug Debug flag
* *
* @return Configuration * @return Configuration
@ -361,7 +370,7 @@ class Configuration
$this->debug = $debug; $this->debug = $debug;
return $this; return $this;
} }
/** /**
* Gets the debug flag * Gets the debug flag
* *
@ -371,7 +380,7 @@ class Configuration
{ {
return $this->debug; return $this->debug;
} }
/** /**
* Sets the debug file * Sets the debug file
* *
@ -384,7 +393,7 @@ class Configuration
$this->debugFile = $debugFile; $this->debugFile = $debugFile;
return $this; return $this;
} }
/** /**
* Gets the debug file * Gets the debug file
* *
@ -394,7 +403,7 @@ class Configuration
{ {
return $this->debugFile; return $this->debugFile;
} }
/** /**
* Sets the temp folder path * Sets the temp folder path
* *
@ -407,7 +416,7 @@ class Configuration
$this->tempFolderPath = $tempFolderPath; $this->tempFolderPath = $tempFolderPath;
return $this; return $this;
} }
/** /**
* Gets the temp folder path * Gets the temp folder path
* *
@ -417,7 +426,30 @@ class Configuration
{ {
return $this->tempFolderPath; return $this->tempFolderPath;
} }
/**
* Sets if SSL verification should be enabled or disabled
*
* @param boolean $sslVerification True if the certificate should be validated, false otherwise
*
* @return Configuration
*/
public function setSSLVerification($sslVerification)
{
$this->sslVerification = $sslVerification;
return $this;
}
/**
* Gets if SSL verification should be enabled or disabled
*
* @return boolean True if the certificate should be validated, false otherwise
*/
public function getSSLVerification()
{
return $this->sslVerification;
}
/** /**
* Gets the default configuration instance * Gets the default configuration instance
* *
@ -428,10 +460,10 @@ class Configuration
if (self::$_defaultConfiguration == null) { if (self::$_defaultConfiguration == null) {
self::$_defaultConfiguration = new Configuration(); self::$_defaultConfiguration = new Configuration();
} }
return self::$_defaultConfiguration; return self::$_defaultConfiguration;
} }
/** /**
* Sets the detault configuration instance * Sets the detault configuration instance
* *
@ -443,7 +475,7 @@ class Configuration
{ {
self::$_defaultConfiguration = $config; self::$_defaultConfiguration = $config;
} }
/** /**
* Gets the essential information for debugging * Gets the essential information for debugging
* *
@ -457,8 +489,8 @@ class Configuration
$report .= " Swagger Spec Version: 1.0.0\n"; $report .= " Swagger Spec Version: 1.0.0\n";
$report .= " SDK Package Version: 1.0.0\n"; $report .= " SDK Package Version: 1.0.0\n";
$report .= " Temp Folder Path: ".self::getDefaultConfiguration()->getTempFolderPath()."\n"; $report .= " Temp Folder Path: ".self::getDefaultConfiguration()->getTempFolderPath()."\n";
return $report; return $report;
} }
} }

View File

@ -193,7 +193,7 @@ class ObjectSerializer
$deserialized = $values; $deserialized = $values;
} elseif ($class === '\DateTime') { } elseif ($class === '\DateTime') {
$deserialized = new \DateTime($data); $deserialized = new \DateTime($data);
} elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) { } elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) {
settype($data, $class); settype($data, $class);
$deserialized = $data; $deserialized = $data;
} elseif ($class === '\SplFileObject') { } elseif ($class === '\SplFileObject') {