more style change for php client

This commit is contained in:
wing328
2015-12-07 00:52:30 +08:00
parent 442f87c19a
commit 340e60002e
8 changed files with 96 additions and 117 deletions

View File

@@ -131,7 +131,7 @@ class ApiClient
* @throws \{{invokerPackage}}\ApiException on a non 2xx response * @throws \{{invokerPackage}}\ApiException on a non 2xx response
* @return mixed * @return mixed
*/ */
public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType=null) public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType = null)
{ {
$headers = array(); $headers = array();
@@ -149,7 +149,7 @@ class ApiClient
// 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 } elseif ((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));
} }
@@ -160,7 +160,7 @@ class ApiClient
if ($this->config->getCurlTimeout() != 0) { if ($this->config->getCurlTimeout() != 0) {
curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout()); curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout());
} }
// 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);
@@ -178,21 +178,21 @@ class ApiClient
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);
} else if ($method == self::$HEAD) { } elseif ($method == self::$HEAD) {
curl_setopt($curl, CURLOPT_NOBODY, true); curl_setopt($curl, CURLOPT_NOBODY, true);
} else if ($method == self::$OPTIONS) { } elseif ($method == self::$OPTIONS) {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "OPTIONS"); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "OPTIONS");
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} else if ($method == self::$PATCH) { } elseif ($method == self::$PATCH) {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH"); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} else if ($method == self::$PUT) { } elseif ($method == self::$PUT) {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} else if ($method == self::$DELETE) { } elseif ($method == self::$DELETE) {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} else if ($method != self::$GET) { } elseif ($method != self::$GET) {
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);
@@ -228,7 +228,7 @@ class ApiClient
// 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 ) { } elseif ($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, $response_info['http_code'], $http_header); return array($http_body, $response_info['http_code'], $http_header);

View File

@@ -56,14 +56,14 @@ class ObjectSerializer
{ {
if (is_scalar($data) || null === $data) { if (is_scalar($data) || null === $data) {
$sanitized = $data; $sanitized = $data;
} else if ($data instanceof \DateTime) { } elseif ($data instanceof \DateTime) {
$sanitized = $data->format(\DateTime::ISO8601); $sanitized = $data->format(\DateTime::ISO8601);
} else if (is_array($data)) { } elseif (is_array($data)) {
foreach ($data as $property => $value) { foreach ($data as $property => $value) {
$data[$property] = $this->sanitizeForSerialization($value); $data[$property] = $this->sanitizeForSerialization($value);
} }
$sanitized = $data; $sanitized = $data;
} else if (is_object($data)) { } elseif (is_object($data)) {
$values = array(); $values = array();
foreach (array_keys($data::$swaggerTypes) as $property) { foreach (array_keys($data::$swaggerTypes) as $property) {
$getter = $data::$getters[$property]; $getter = $data::$getters[$property];

View File

@@ -100,7 +100,7 @@ use \{{invokerPackage}}\ObjectSerializer;
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
* @throws \{{invokerPackage}}\ApiException on non-2xx response * @throws \{{invokerPackage}}\ApiException on non-2xx response
*/ */
public function {{operationId}}({{#allParams}}${{paramName}}{{^required}}=null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) 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, $statusCode, $httpHeader) = $this->{{operationId}}WithHttpInfo ({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
return $response; return $response;
@@ -116,7 +116,7 @@ use \{{invokerPackage}}\ObjectSerializer;
{{/allParams}} * @return Array of {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) {{/allParams}} * @return Array of {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings)
* @throws \{{invokerPackage}}\ApiException on non-2xx response * @throws \{{invokerPackage}}\ApiException on non-2xx response
*/ */
public function {{operationId}}WithHttpInfo({{#allParams}}${{paramName}}{{^required}}=null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) public function {{operationId}}WithHttpInfo({{#allParams}}${{paramName}}{{^required}} = null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
{ {
{{#allParams}}{{#required}} {{#allParams}}{{#required}}
// verify the required parameter '{{paramName}}' is set // verify the required parameter '{{paramName}}' is set
@@ -178,7 +178,7 @@ use \{{invokerPackage}}\ObjectSerializer;
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
{{#authMethods}}{{#isApiKey}} {{#authMethods}}{{#isApiKey}}
@@ -196,8 +196,7 @@ use \{{invokerPackage}}\ObjectSerializer;
}{{/isOAuth}} }{{/isOAuth}}
{{/authMethods}} {{/authMethods}}
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,

View File

@@ -100,7 +100,7 @@ class PetApi
* @return void * @return void
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function updatePet($body=null) public function updatePet($body = null)
{ {
list($response, $statusCode, $httpHeader) = $this->updatePetWithHttpInfo ($body); list($response, $statusCode, $httpHeader) = $this->updatePetWithHttpInfo ($body);
return $response; return $response;
@@ -116,7 +116,7 @@ class PetApi
* @return Array of null, HTTP status code, HTTP response headers (array of strings) * @return Array of null, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function updatePetWithHttpInfo($body=null) public function updatePetWithHttpInfo($body = null)
{ {
@@ -147,7 +147,7 @@ class PetApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
@@ -157,8 +157,7 @@ class PetApi
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -184,7 +183,7 @@ class PetApi
* @return void * @return void
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function addPet($body=null) public function addPet($body = null)
{ {
list($response, $statusCode, $httpHeader) = $this->addPetWithHttpInfo ($body); list($response, $statusCode, $httpHeader) = $this->addPetWithHttpInfo ($body);
return $response; return $response;
@@ -200,7 +199,7 @@ class PetApi
* @return Array of null, HTTP status code, HTTP response headers (array of strings) * @return Array of null, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function addPetWithHttpInfo($body=null) public function addPetWithHttpInfo($body = null)
{ {
@@ -231,7 +230,7 @@ class PetApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
@@ -241,8 +240,7 @@ class PetApi
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -268,7 +266,7 @@ class PetApi
* @return \Swagger\Client\Model\Pet[] * @return \Swagger\Client\Model\Pet[]
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function findPetsByStatus($status=null) public function findPetsByStatus($status = null)
{ {
list($response, $statusCode, $httpHeader) = $this->findPetsByStatusWithHttpInfo ($status); list($response, $statusCode, $httpHeader) = $this->findPetsByStatusWithHttpInfo ($status);
return $response; return $response;
@@ -284,7 +282,7 @@ class PetApi
* @return Array of \Swagger\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) * @return Array of \Swagger\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function findPetsByStatusWithHttpInfo($status=null) public function findPetsByStatusWithHttpInfo($status = null)
{ {
@@ -314,7 +312,7 @@ class PetApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
@@ -324,8 +322,7 @@ class PetApi
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -359,7 +356,7 @@ class PetApi
* @return \Swagger\Client\Model\Pet[] * @return \Swagger\Client\Model\Pet[]
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function findPetsByTags($tags=null) public function findPetsByTags($tags = null)
{ {
list($response, $statusCode, $httpHeader) = $this->findPetsByTagsWithHttpInfo ($tags); list($response, $statusCode, $httpHeader) = $this->findPetsByTagsWithHttpInfo ($tags);
return $response; return $response;
@@ -375,7 +372,7 @@ class PetApi
* @return Array of \Swagger\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) * @return Array of \Swagger\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function findPetsByTagsWithHttpInfo($tags=null) public function findPetsByTagsWithHttpInfo($tags = null)
{ {
@@ -405,7 +402,7 @@ class PetApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
@@ -415,8 +412,7 @@ class PetApi
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -504,7 +500,7 @@ class PetApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
@@ -516,8 +512,7 @@ class PetApi
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -553,7 +548,7 @@ class PetApi
* @return void * @return void
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function updatePetWithForm($pet_id, $name=null, $status=null) public function updatePetWithForm($pet_id, $name = null, $status = null)
{ {
list($response, $statusCode, $httpHeader) = $this->updatePetWithFormWithHttpInfo ($pet_id, $name, $status); list($response, $statusCode, $httpHeader) = $this->updatePetWithFormWithHttpInfo ($pet_id, $name, $status);
return $response; return $response;
@@ -571,7 +566,7 @@ class PetApi
* @return Array of null, HTTP status code, HTTP response headers (array of strings) * @return Array of null, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function updatePetWithFormWithHttpInfo($pet_id, $name=null, $status=null) public function updatePetWithFormWithHttpInfo($pet_id, $name = null, $status = null)
{ {
// verify the required parameter 'pet_id' is set // verify the required parameter 'pet_id' is set
@@ -621,7 +616,7 @@ class PetApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
@@ -631,8 +626,7 @@ class PetApi
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -659,7 +653,7 @@ class PetApi
* @return void * @return void
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function deletePet($pet_id, $api_key=null) public function deletePet($pet_id, $api_key = null)
{ {
list($response, $statusCode, $httpHeader) = $this->deletePetWithHttpInfo ($pet_id, $api_key); list($response, $statusCode, $httpHeader) = $this->deletePetWithHttpInfo ($pet_id, $api_key);
return $response; return $response;
@@ -676,7 +670,7 @@ class PetApi
* @return Array of null, HTTP status code, HTTP response headers (array of strings) * @return Array of null, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function deletePetWithHttpInfo($pet_id, $api_key=null) public function deletePetWithHttpInfo($pet_id, $api_key = null)
{ {
// verify the required parameter 'pet_id' is set // verify the required parameter 'pet_id' is set
@@ -717,7 +711,7 @@ class PetApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
@@ -727,8 +721,7 @@ class PetApi
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -756,7 +749,7 @@ class PetApi
* @return void * @return void
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function uploadFile($pet_id, $additional_metadata=null, $file=null) public function uploadFile($pet_id, $additional_metadata = null, $file = null)
{ {
list($response, $statusCode, $httpHeader) = $this->uploadFileWithHttpInfo ($pet_id, $additional_metadata, $file); list($response, $statusCode, $httpHeader) = $this->uploadFileWithHttpInfo ($pet_id, $additional_metadata, $file);
return $response; return $response;
@@ -774,7 +767,7 @@ class PetApi
* @return Array of null, HTTP status code, HTTP response headers (array of strings) * @return Array of null, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function uploadFileWithHttpInfo($pet_id, $additional_metadata=null, $file=null) public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $file = null)
{ {
// verify the required parameter 'pet_id' is set // verify the required parameter 'pet_id' is set
@@ -830,7 +823,7 @@ class PetApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
@@ -840,8 +833,7 @@ class PetApi
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,

View File

@@ -141,7 +141,7 @@ class StoreApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
@@ -153,8 +153,7 @@ class StoreApi
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -188,7 +187,7 @@ class StoreApi
* @return \Swagger\Client\Model\Order * @return \Swagger\Client\Model\Order
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function placeOrder($body=null) public function placeOrder($body = null)
{ {
list($response, $statusCode, $httpHeader) = $this->placeOrderWithHttpInfo ($body); list($response, $statusCode, $httpHeader) = $this->placeOrderWithHttpInfo ($body);
return $response; return $response;
@@ -204,7 +203,7 @@ class StoreApi
* @return Array of \Swagger\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) * @return Array of \Swagger\Client\Model\Order, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function placeOrderWithHttpInfo($body=null) public function placeOrderWithHttpInfo($body = null)
{ {
@@ -235,13 +234,12 @@ class StoreApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -329,13 +327,12 @@ class StoreApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -423,13 +420,12 @@ class StoreApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,

View File

@@ -100,7 +100,7 @@ class UserApi
* @return void * @return void
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function createUser($body=null) public function createUser($body = null)
{ {
list($response, $statusCode, $httpHeader) = $this->createUserWithHttpInfo ($body); list($response, $statusCode, $httpHeader) = $this->createUserWithHttpInfo ($body);
return $response; return $response;
@@ -116,7 +116,7 @@ class UserApi
* @return Array of null, HTTP status code, HTTP response headers (array of strings) * @return Array of null, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function createUserWithHttpInfo($body=null) public function createUserWithHttpInfo($body = null)
{ {
@@ -147,13 +147,12 @@ class UserApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -179,7 +178,7 @@ class UserApi
* @return void * @return void
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function createUsersWithArrayInput($body=null) public function createUsersWithArrayInput($body = null)
{ {
list($response, $statusCode, $httpHeader) = $this->createUsersWithArrayInputWithHttpInfo ($body); list($response, $statusCode, $httpHeader) = $this->createUsersWithArrayInputWithHttpInfo ($body);
return $response; return $response;
@@ -195,7 +194,7 @@ class UserApi
* @return Array of null, HTTP status code, HTTP response headers (array of strings) * @return Array of null, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function createUsersWithArrayInputWithHttpInfo($body=null) public function createUsersWithArrayInputWithHttpInfo($body = null)
{ {
@@ -226,13 +225,12 @@ class UserApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -258,7 +256,7 @@ class UserApi
* @return void * @return void
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function createUsersWithListInput($body=null) public function createUsersWithListInput($body = null)
{ {
list($response, $statusCode, $httpHeader) = $this->createUsersWithListInputWithHttpInfo ($body); list($response, $statusCode, $httpHeader) = $this->createUsersWithListInputWithHttpInfo ($body);
return $response; return $response;
@@ -274,7 +272,7 @@ class UserApi
* @return Array of null, HTTP status code, HTTP response headers (array of strings) * @return Array of null, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function createUsersWithListInputWithHttpInfo($body=null) public function createUsersWithListInputWithHttpInfo($body = null)
{ {
@@ -305,13 +303,12 @@ class UserApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -338,7 +335,7 @@ class UserApi
* @return string * @return string
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function loginUser($username=null, $password=null) public function loginUser($username = null, $password = null)
{ {
list($response, $statusCode, $httpHeader) = $this->loginUserWithHttpInfo ($username, $password); list($response, $statusCode, $httpHeader) = $this->loginUserWithHttpInfo ($username, $password);
return $response; return $response;
@@ -355,7 +352,7 @@ class UserApi
* @return Array of string, HTTP status code, HTTP response headers (array of strings) * @return Array of string, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function loginUserWithHttpInfo($username=null, $password=null) public function loginUserWithHttpInfo($username = null, $password = null)
{ {
@@ -388,13 +385,12 @@ class UserApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -469,13 +465,12 @@ class UserApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -555,13 +550,12 @@ class UserApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -596,7 +590,7 @@ class UserApi
* @return void * @return void
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function updateUser($username, $body=null) public function updateUser($username, $body = null)
{ {
list($response, $statusCode, $httpHeader) = $this->updateUserWithHttpInfo ($username, $body); list($response, $statusCode, $httpHeader) = $this->updateUserWithHttpInfo ($username, $body);
return $response; return $response;
@@ -613,7 +607,7 @@ class UserApi
* @return Array of null, HTTP status code, HTTP response headers (array of strings) * @return Array of null, HTTP status code, HTTP response headers (array of strings)
* @throws \Swagger\Client\ApiException on non-2xx response * @throws \Swagger\Client\ApiException on non-2xx response
*/ */
public function updateUserWithHttpInfo($username, $body=null) public function updateUserWithHttpInfo($username, $body = null)
{ {
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
@@ -655,13 +649,12 @@ class UserApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,
@@ -741,13 +734,12 @@ class UserApi
// for model (json/xml) // for model (json/xml)
if (isset($_tempBody)) { if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} else if (count($formParams) > 0) { } elseif (count($formParams) > 0) {
$httpBody = $formParams; // for HTTP post (form) $httpBody = $formParams; // for HTTP post (form)
} }
// make the API Call // make the API Call
try try {
{
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
$resourcePath, $method, $resourcePath, $method,
$queryParams, $httpBody, $queryParams, $httpBody,

View File

@@ -131,7 +131,7 @@ class ApiClient
* @throws \Swagger\Client\ApiException on a non 2xx response * @throws \Swagger\Client\ApiException on a non 2xx response
* @return mixed * @return mixed
*/ */
public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType=null) public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType = null)
{ {
$headers = array(); $headers = array();
@@ -149,7 +149,7 @@ class ApiClient
// 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 } elseif ((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));
} }
@@ -160,7 +160,7 @@ class ApiClient
if ($this->config->getCurlTimeout() != 0) { if ($this->config->getCurlTimeout() != 0) {
curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout()); curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout());
} }
// 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);
@@ -178,21 +178,21 @@ class ApiClient
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);
} else if ($method == self::$HEAD) { } elseif ($method == self::$HEAD) {
curl_setopt($curl, CURLOPT_NOBODY, true); curl_setopt($curl, CURLOPT_NOBODY, true);
} else if ($method == self::$OPTIONS) { } elseif ($method == self::$OPTIONS) {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "OPTIONS"); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "OPTIONS");
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} else if ($method == self::$PATCH) { } elseif ($method == self::$PATCH) {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH"); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} else if ($method == self::$PUT) { } elseif ($method == self::$PUT) {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} else if ($method == self::$DELETE) { } elseif ($method == self::$DELETE) {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
} else if ($method != self::$GET) { } elseif ($method != self::$GET) {
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);
@@ -228,7 +228,7 @@ class ApiClient
// 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 ) { } elseif ($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, $response_info['http_code'], $http_header); return array($http_body, $response_info['http_code'], $http_header);

View File

@@ -56,14 +56,14 @@ class ObjectSerializer
{ {
if (is_scalar($data) || null === $data) { if (is_scalar($data) || null === $data) {
$sanitized = $data; $sanitized = $data;
} else if ($data instanceof \DateTime) { } elseif ($data instanceof \DateTime) {
$sanitized = $data->format(\DateTime::ISO8601); $sanitized = $data->format(\DateTime::ISO8601);
} else if (is_array($data)) { } elseif (is_array($data)) {
foreach ($data as $property => $value) { foreach ($data as $property => $value) {
$data[$property] = $this->sanitizeForSerialization($value); $data[$property] = $this->sanitizeForSerialization($value);
} }
$sanitized = $data; $sanitized = $data;
} else if (is_object($data)) { } elseif (is_object($data)) {
$values = array(); $values = array();
foreach (array_keys($data::$swaggerTypes) as $property) { foreach (array_keys($data::$swaggerTypes) as $property) {
$getter = $data::$getters[$property]; $getter = $data::$getters[$property];