Merge branch 'master' into new-sync-master-to-2.3.0

This commit is contained in:
Paŭlo Ebermann
2017-03-13 21:10:53 +01:00
1040 changed files with 17614 additions and 5102 deletions

View File

@@ -129,9 +129,6 @@ class FakeApi
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// body params
$_tempBody = null;
if (isset($body)) {
@@ -296,9 +293,6 @@ class FakeApi
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/xml; charset=utf-8', 'application/json; charset=utf-8']);
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// form params
if ($integer !== null) {
$formParams['integer'] = $this->apiClient->getSerializer()->toFormValue($integer);
@@ -465,9 +459,6 @@ class FakeApi
if ($enum_header_string !== null) {
$headerParams['enum_header_string'] = $this->apiClient->getSerializer()->toHeaderValue($enum_header_string);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// form params
if ($enum_form_string_array !== null) {
$formParams['enum_form_string_array'] = $this->apiClient->getSerializer()->toFormValue($enum_form_string_array);

View File

@@ -129,9 +129,6 @@ class Fake_classname_tags123Api
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']);
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// body params
$_tempBody = null;
if (isset($body)) {

View File

@@ -129,9 +129,6 @@ class PetApi
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json', 'application/xml']);
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// body params
$_tempBody = null;
if (isset($body)) {
@@ -225,9 +222,6 @@ class PetApi
$resourcePath
);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
@@ -309,9 +303,6 @@ class PetApi
if ($status !== null) {
$queryParams['status'] = $this->apiClient->getSerializer()->toQueryValue($status);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
@@ -397,9 +388,6 @@ class PetApi
if ($tags !== null) {
$queryParams['tags'] = $this->apiClient->getSerializer()->toQueryValue($tags);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
@@ -486,9 +474,6 @@ class PetApi
$resourcePath
);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
@@ -568,9 +553,6 @@ class PetApi
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json', 'application/xml']);
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// body params
$_tempBody = null;
if (isset($body)) {
@@ -662,9 +644,6 @@ class PetApi
$resourcePath
);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// form params
if ($name !== null) {
$formParams['name'] = $this->apiClient->getSerializer()->toFormValue($name);
@@ -759,9 +738,6 @@ class PetApi
$resourcePath
);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// form params
if ($additional_metadata !== null) {
$formParams['additionalMetadata'] = $this->apiClient->getSerializer()->toFormValue($additional_metadata);

View File

@@ -137,9 +137,6 @@ class StoreApi
$resourcePath
);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
@@ -204,9 +201,6 @@ class StoreApi
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]);
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
@@ -301,9 +295,6 @@ class StoreApi
$resourcePath
);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
@@ -378,9 +369,6 @@ class StoreApi
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]);
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// body params
$_tempBody = null;
if (isset($body)) {

View File

@@ -129,9 +129,6 @@ class UserApi
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]);
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// body params
$_tempBody = null;
if (isset($body)) {
@@ -207,9 +204,6 @@ class UserApi
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]);
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// body params
$_tempBody = null;
if (isset($body)) {
@@ -285,9 +279,6 @@ class UserApi
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]);
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// body params
$_tempBody = null;
if (isset($body)) {
@@ -371,9 +362,6 @@ class UserApi
$resourcePath
);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
@@ -452,9 +440,6 @@ class UserApi
$resourcePath
);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
@@ -543,9 +528,6 @@ class UserApi
if ($password !== null) {
$queryParams['password'] = $this->apiClient->getSerializer()->toQueryValue($password);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
@@ -614,9 +596,6 @@ class UserApi
}
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]);
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// for model (json/xml)
if (isset($_tempBody)) {
@@ -701,9 +680,6 @@ class UserApi
$resourcePath
);
}
// default format to json
$resourcePath = str_replace("{format}", "json", $resourcePath);
// body params
$_tempBody = null;
if (isset($body)) {

View File

@@ -68,9 +68,9 @@ class ApiException extends Exception
* @param string $message Error message
* @param int $code HTTP status code
* @param string[]|null $responseHeaders HTTP response header
* @param mixed $responseBody HTTP body of the server response either as Json or string
* @param mixed $responseBody HTTP decoded body of the server response either as \stdClass or string
*/
public function __construct($message = "", $code = 0, array $responseHeaders = null, $responseBody = null)
public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null)
{
parent::__construct($message, $code);
$this->responseHeaders = $responseHeaders;
@@ -90,7 +90,7 @@ class ApiException extends Exception
/**
* Gets the HTTP body of the server response either as Json or string
*
* @return mixed HTTP body of the server response either as Json or string
* @return mixed HTTP body of the server response either as \stdClass or string
*/
public function getResponseBody()
{

View File

@@ -39,7 +39,7 @@ namespace Swagger\Client;
*/
class Configuration
{
private static $defaultConfiguration = null;
private static $defaultConfiguration;
/**
* Associate array to store API key(s)
@@ -109,7 +109,7 @@ class Configuration
*
* @var string
*/
protected $userAgent = "Swagger-Codegen/1.0.0/php";
protected $userAgent = 'Swagger-Codegen/1.0.0/php';
/**
* Debug switch (default set to false)
@@ -191,7 +191,7 @@ class Configuration
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
* @param string $key API key or token
*
* @return Configuration
* @return $this
*/
public function setApiKey($apiKeyIdentifier, $key)
{
@@ -217,7 +217,7 @@ class Configuration
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
* @param string $prefix API key prefix, e.g. Bearer
*
* @return Configuration
* @return $this
*/
public function setApiKeyPrefix($apiKeyIdentifier, $prefix)
{
@@ -242,7 +242,7 @@ class Configuration
*
* @param string $accessToken Token for OAuth
*
* @return Configuration
* @return $this
*/
public function setAccessToken($accessToken)
{
@@ -265,7 +265,7 @@ class Configuration
*
* @param string $username Username for HTTP basic authentication
*
* @return Configuration
* @return $this
*/
public function setUsername($username)
{
@@ -288,7 +288,7 @@ class Configuration
*
* @param string $password Password for HTTP basic authentication
*
* @return Configuration
* @return $this
*/
public function setPassword($password)
{
@@ -312,7 +312,8 @@ class Configuration
* @param string $headerName header name (e.g. Token)
* @param string $headerValue header value (e.g. 1z8wp3)
*
* @return Configuration
* @throws \InvalidArgumentException
* @return $this
*/
public function addDefaultHeader($headerName, $headerValue)
{
@@ -339,11 +340,12 @@ class Configuration
*
* @param string $headerName the header to delete
*
* @return Configuration
* @return $this
*/
public function deleteDefaultHeader($headerName)
{
unset($this->defaultHeaders[$headerName]);
return $this;
}
/**
@@ -351,7 +353,7 @@ class Configuration
*
* @param string $host Host
*
* @return Configuration
* @return $this
*/
public function setHost($host)
{
@@ -374,7 +376,8 @@ class Configuration
*
* @param string $userAgent the user agent of the api client
*
* @return Configuration
* @throws \InvalidArgumentException
* @return $this
*/
public function setUserAgent($userAgent)
{
@@ -401,7 +404,8 @@ class Configuration
*
* @param integer $seconds Number of seconds before timing out [set to 0 for no timeout]
*
* @return Configuration
* @throws \InvalidArgumentException
* @return $this
*/
public function setCurlTimeout($seconds)
{
@@ -428,7 +432,8 @@ class Configuration
*
* @param integer $seconds Number of seconds before connection times out [set to 0 for no timeout]
*
* @return Configuration
* @throws \InvalidArgumentException
* @return $this
*/
public function setCurlConnectTimeout($seconds)
{
@@ -456,7 +461,7 @@ class Configuration
*
* @param string $proxyHost HTTP Proxy URL
*
* @return ApiClient
* @return $this
*/
public function setCurlProxyHost($proxyHost)
{
@@ -479,7 +484,7 @@ class Configuration
*
* @param integer $proxyPort HTTP Proxy Port
*
* @return ApiClient
* @return $this
*/
public function setCurlProxyPort($proxyPort)
{
@@ -502,7 +507,7 @@ class Configuration
*
* @param integer $proxyType HTTP Proxy Type
*
* @return ApiClient
* @return $this
*/
public function setCurlProxyType($proxyType)
{
@@ -525,7 +530,7 @@ class Configuration
*
* @param string $proxyUser HTTP Proxy User
*
* @return ApiClient
* @return $this
*/
public function setCurlProxyUser($proxyUser)
{
@@ -548,7 +553,7 @@ class Configuration
*
* @param string $proxyPassword HTTP Proxy Password
*
* @return ApiClient
* @return $this
*/
public function setCurlProxyPassword($proxyPassword)
{
@@ -571,7 +576,7 @@ class Configuration
*
* @param bool $debug Debug flag
*
* @return Configuration
* @return $this
*/
public function setDebug($debug)
{
@@ -594,7 +599,7 @@ class Configuration
*
* @param string $debugFile Debug file
*
* @return Configuration
* @return $this
*/
public function setDebugFile($debugFile)
{
@@ -617,7 +622,7 @@ class Configuration
*
* @param string $tempFolderPath Temp folder path
*
* @return Configuration
* @return $this
*/
public function setTempFolderPath($tempFolderPath)
{
@@ -640,7 +645,7 @@ class Configuration
*
* @param boolean $sslVerification True if the certificate should be validated, false otherwise
*
* @return Configuration
* @return $this
*/
public function setSSLVerification($sslVerification)
{
@@ -693,7 +698,7 @@ class Configuration
{
$report = 'PHP SDK (Swagger\Client) Debug Report:' . PHP_EOL;
$report .= ' OS: ' . php_uname() . PHP_EOL;
$report .= ' PHP Version: ' . phpversion() . PHP_EOL;
$report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL;
$report .= ' OpenAPI Spec Version: 1.0.0' . PHP_EOL;
$report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;

View File

@@ -29,8 +29,6 @@
namespace Swagger\Client\Model;
use \ArrayAccess;
/**
* EnumClass Class Doc Comment
*
@@ -40,11 +38,25 @@ use \ArrayAccess;
* @link https://github.com/swagger-api/swagger-codegen
*/
class EnumClass {
/**
* Possible values of this enum
*/
const ABC = '_abc';
const EFG = '-efg';
const XYZ = '(xyz)';
/**
* Gets allowable values of the enum
* @return string[]
*/
public static function getAllowableEnumValues()
{
return [
self::ABC,
self::EFG,
self::XYZ,
];
}
}

View File

@@ -29,8 +29,6 @@
namespace Swagger\Client\Model;
use \ArrayAccess;
/**
* OuterEnum Class Doc Comment
*
@@ -40,11 +38,25 @@ use \ArrayAccess;
* @link https://github.com/swagger-api/swagger-codegen
*/
class OuterEnum {
/**
* Possible values of this enum
*/
const PLACED = 'placed';
const APPROVED = 'approved';
const DELIVERED = 'delivered';
/**
* Gets allowable values of the enum
* @return string[]
*/
public static function getAllowableEnumValues()
{
return [
self::PLACED,
self::APPROVED,
self::DELIVERED,
];
}
}

View File

@@ -59,10 +59,16 @@ class ObjectSerializer
return $data;
} elseif (is_object($data)) {
$values = [];
foreach (array_keys($data::swaggerTypes()) as $property) {
foreach ($data::swaggerTypes() as $property => $swaggerType) {
$getter = $data::getters()[$property];
if ($data->$getter() !== null) {
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($data->$getter());
$value = $data->$getter();
if (method_exists($swaggerType, 'getAllowableEnumValues')
&& !in_array($value, $swaggerType::getAllowableEnumValues())) {
$imploded = implode("', '", $swaggerType::getAllowableEnumValues());
throw new \InvalidArgumentException("Invalid value for enum '$swaggerType', must be one of: '$imploded'");
}
if ($value !== null) {
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value);
}
}
return (object)$values;
@@ -269,6 +275,12 @@ class ObjectSerializer
}
return $deserialized;
} elseif (method_exists($class, 'getAllowableEnumValues')) {
if (!in_array($data, $class::getAllowableEnumValues())) {
$imploded = implode("', '", $class::getAllowableEnumValues());
throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'");
}
return $data;
} else {
// If a discriminator is defined and points to a valid subclass, use it.
$discriminator = $class::DISCRIMINATOR;