From d9dd68274156258cb19a1b04ebbf0a008aaae1c8 Mon Sep 17 00:00:00 2001 From: "akihito.nakano" Date: Sat, 16 Sep 2017 13:15:51 +0900 Subject: [PATCH 1/5] Improve spacing in doc comment --- .../src/main/resources/php/api.mustache | 14 +- .../php/SwaggerClient-php/lib/Api/FakeApi.php | 14 +- .../petstore/php/SwaggerClient-php/README.md | 12 +- .../docs/Api/AnotherFakeApi.md | 8 +- .../php/SwaggerClient-php/docs/Api/FakeApi.md | 2 +- .../docs/Api/Fake_classname_tags123Api.md | 57 ++++ .../SwaggerClient-php/docs/Api/StoreApi.md | 2 +- .../lib/Api/AnotherFakeApi.php | 20 +- .../php/SwaggerClient-php/lib/Api/FakeApi.php | 298 ++++++++--------- .../lib/Api/Fake_classname_tags123Api.php | 314 ++++++++++++++++++ .../php/SwaggerClient-php/lib/Api/PetApi.php | 134 ++++---- .../SwaggerClient-php/lib/Api/StoreApi.php | 34 +- .../php/SwaggerClient-php/lib/Api/UserApi.php | 94 +++--- .../lib/Model/FormatTest.php | 12 - .../Api/Fake_classname_tags123ApiTest.php | 83 +++++ 15 files changed, 770 insertions(+), 328 deletions(-) create mode 100644 samples/client/petstore/php/SwaggerClient-php/docs/Api/Fake_classname_tags123Api.md create mode 100644 samples/client/petstore/php/SwaggerClient-php/lib/Api/Fake_classname_tags123Api.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/test/Api/Fake_classname_tags123ApiTest.php diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index 1fa2640c880..b4440213240 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -50,8 +50,8 @@ use {{invokerPackage}}\ObjectSerializer; /** * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector + * @param Configuration $config + * @param HeaderSelector $selector */ public function __construct( ClientInterface $client = null, @@ -84,7 +84,7 @@ use {{invokerPackage}}\ObjectSerializer; * {{/description}} {{#allParams}} - * @param {{dataType}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} + * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} {{/allParams}} * @throws \{{invokerPackage}}\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -108,7 +108,7 @@ use {{invokerPackage}}\ObjectSerializer; * {{/description}} {{#allParams}} - * @param {{dataType}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} + * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} {{/allParams}} * @throws \{{invokerPackage}}\ApiException on non-2xx response * @throws \InvalidArgumentException @@ -188,7 +188,7 @@ use {{invokerPackage}}\ObjectSerializer; * {{/description}} {{#allParams}} - * @param {{dataType}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} + * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} {{/allParams}} * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -210,7 +210,7 @@ use {{invokerPackage}}\ObjectSerializer; * {{/description}} {{#allParams}} - * @param {{dataType}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} + * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} {{/allParams}} * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface @@ -257,7 +257,7 @@ use {{invokerPackage}}\ObjectSerializer; * Create request for operation '{{{operationId}}}' * {{#allParams}} - * @param {{dataType}} ${{paramName}} {{description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} + * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} {{/allParams}} * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php index b5ea0314811..d62ba12d2e8 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -60,8 +60,8 @@ class FakeApi /** * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector + * @param Configuration $config + * @param HeaderSelector $selector */ public function __construct( ClientInterface $client = null, @@ -86,7 +86,7 @@ public function getConfig() * * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * - * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) + * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -101,7 +101,7 @@ public function testCodeInjectEndRnNR($test_code_inject____end____rn_n_r = null) * * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * - * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) + * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -148,7 +148,7 @@ public function testCodeInjectEndRnNRWithHttpInfo($test_code_inject____end____rn * * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * - * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) + * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -164,7 +164,7 @@ public function testCodeInjectEndRnNRAsync($test_code_inject____end____rn_n_r = * * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * - * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) + * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -190,7 +190,7 @@ public function testCodeInjectEndRnNRAsyncWithHttpInfo($test_code_inject____end_ /** * Create request for operation 'testCodeInjectEndRnNR' * - * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) + * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 83b6d6e01a1..7e6e53dd932 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -56,14 +56,14 @@ Please follow the [installation procedure](#installation--usage) and then run th testSpecialTags($body); + $result = $api_instance->fakeOuterBooleanSerialize($body); print_r($result); } catch (Exception $e) { - echo 'Exception when calling AnotherFakeApi->testSpecialTags: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling FakeApi->fakeOuterBooleanSerialize: ', $e->getMessage(), PHP_EOL; } ?> @@ -75,7 +75,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**testSpecialTags**](docs/Api/AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags *FakeApi* | [**fakeOuterBooleanSerialize**](docs/Api/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | *FakeApi* | [**fakeOuterCompositeSerialize**](docs/Api/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | *FakeApi* | [**fakeOuterNumberSerialize**](docs/Api/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | @@ -84,7 +83,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**testEndpointParameters**](docs/Api/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**testEnumParameters**](docs/Api/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters *FakeApi* | [**testJsonFormData**](docs/Api/FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data -*FakeClassnameTags123Api* | [**testClassname**](docs/Api/FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case +*Fake_classname_tags123Api* | [**testClassname**](docs/Api/Fake_classname_tags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/Api/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/Api/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**findPetsByStatus**](docs/Api/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status @@ -105,6 +104,7 @@ Class | Method | HTTP request | Description *UserApi* | [**loginUser**](docs/Api/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system *UserApi* | [**logoutUser**](docs/Api/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session *UserApi* | [**updateUser**](docs/Api/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user +*AnotherfakeApi* | [**testSpecialTags**](docs/Api/AnotherfakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags ## Documentation For Models diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Api/AnotherFakeApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/Api/AnotherFakeApi.md index 5b443618999..53bd4be8062 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Api/AnotherFakeApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Api/AnotherFakeApi.md @@ -1,10 +1,10 @@ -# Swagger\Client\AnotherFakeApi +# Swagger\Client\AnotherfakeApi All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**testSpecialTags**](AnotherFakeApi.md#testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags +[**testSpecialTags**](AnotherfakeApi.md#testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags # **testSpecialTags** @@ -19,14 +19,14 @@ To test special tags testSpecialTags($body); print_r($result); } catch (Exception $e) { - echo 'Exception when calling AnotherFakeApi->testSpecialTags: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling AnotherfakeApi->testSpecialTags: ', $e->getMessage(), PHP_EOL; } ?> ``` diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md index 20958d97da2..1691f3d27a8 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md @@ -259,7 +259,7 @@ $api_instance = new Swagger\Client\Api\FakeApi(new \Http\Adapter\Guzzle6\Client( $number = 3.4; // float | None $double = 1.2; // double | None $pattern_without_delimiter = "pattern_without_delimiter_example"; // string | None -$byte = "byte_example"; // string | None +$byte = "B"; // string | None $integer = 56; // int | None $int32 = 56; // int | None $int64 = 789; // int | None diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Api/Fake_classname_tags123Api.md b/samples/client/petstore/php/SwaggerClient-php/docs/Api/Fake_classname_tags123Api.md new file mode 100644 index 00000000000..d5fe15b46fc --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Api/Fake_classname_tags123Api.md @@ -0,0 +1,57 @@ +# Swagger\Client\Fake_classname_tags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](Fake_classname_tags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case + + +# **testClassname** +> \Swagger\Client\Model\Client testClassname($body) + +To test class name in snake case + +### Example +```php +setApiKey('api_key_query', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key_query', 'Bearer'); + +$api_instance = new Swagger\Client\Api\Fake_classname_tags123Api(new \Http\Adapter\Guzzle6\Client()); +$body = new \Swagger\Client\Model\Client(); // \Swagger\Client\Model\Client | client model + +try { + $result = $api_instance->testClassname($body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling Fake_classname_tags123Api->testClassname: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**\Swagger\Client\Model\Client**](../Model/Client.md)| client model | + +### Return type + +[**\Swagger\Client\Model\Client**](../Model/Client.md) + +### Authorization + +[api_key_query](../../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Api/StoreApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/Api/StoreApi.md index 9daa65eba7b..a377df225db 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Api/StoreApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Api/StoreApi.md @@ -87,7 +87,7 @@ This endpoint does not need any parameter. ### Return type -**map[string,int]** +[**map[string,int]**](../Model/map.md) ### Authorization diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/AnotherFakeApi.php index f50a1730338..ed5bda8a420 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/AnotherFakeApi.php @@ -1,6 +1,6 @@ client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation testClassname + * + * To test class name in snake case + * + * @param \Swagger\Client\Model\Client $body client model (required) + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Swagger\Client\Model\Client + */ + public function testClassname($body) + { + list($response) = $this->testClassnameWithHttpInfo($body); + return $response; + } + + /** + * Operation testClassnameWithHttpInfo + * + * To test class name in snake case + * + * @param \Swagger\Client\Model\Client $body client model (required) + * @throws \Swagger\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Swagger\Client\Model\Client, HTTP status code, HTTP response headers (array of strings) + */ + public function testClassnameWithHttpInfo($body) + { + $returnType = '\Swagger\Client\Model\Client'; + $request = $this->testClassnameRequest($body); + + try { + + try { + $response = $this->client->send($request); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + "[$statusCode] Error connecting to the API ({$request->getUri()})", + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Client', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation testClassnameAsync + * + * To test class name in snake case + * + * @param \Swagger\Client\Model\Client $body client model (required) + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testClassnameAsync($body) + { + return $this->testClassnameAsyncWithHttpInfo($body)->then(function ($response) { + return $response[0]; + }); + } + + /** + * Operation testClassnameAsyncWithHttpInfo + * + * To test class name in snake case + * + * @param \Swagger\Client\Model\Client $body client model (required) + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testClassnameAsyncWithHttpInfo($body) + { + $returnType = '\Swagger\Client\Model\Client'; + $request = $this->testClassnameRequest($body); + + return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); + } + + /** + * Create request for operation 'testClassname' + * + * @param \Swagger\Client\Model\Client $body client model (required) + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function testClassnameRequest($body) + { + // verify the required parameter 'body' is set + if ($body === null) { + throw new \InvalidArgumentException('Missing the required parameter $body when calling testClassname'); + } + + $resourcePath = '/fake_classname_test'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + if ($multipart) { + $headers= $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + $httpBody = $_tempBody; // $_tempBody is the method argument, if present + + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('api_key_query'); + if ($apiKey !== null) { + $queryParams['api_key_query'] = $apiKey; + } + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + return new Request( + 'PATCH', + $url, + $headers, + $httpBody + ); + } + +} diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php index e2ab3e4713f..30773ab34a8 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -60,8 +60,8 @@ class PetApi /** * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector + * @param Configuration $config + * @param HeaderSelector $selector */ public function __construct( ClientInterface $client = null, @@ -86,7 +86,7 @@ public function getConfig() * * Add a new pet to the store * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -101,7 +101,7 @@ public function addPet($body) * * Add a new pet to the store * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -148,7 +148,7 @@ public function addPetWithHttpInfo($body) * * Add a new pet to the store * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -164,7 +164,7 @@ public function addPetAsync($body) * * Add a new pet to the store * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -190,7 +190,7 @@ public function addPetAsyncWithHttpInfo($body) /** * Create request for operation 'addPet' * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -282,8 +282,8 @@ protected function addPetRequest($body) * * Deletes a pet * - * @param int $pet_id Pet id to delete (required) - * @param string $api_key (optional) + * @param int $pet_id Pet id to delete (required) + * @param string $api_key (optional) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -298,8 +298,8 @@ public function deletePet($pet_id, $api_key = null) * * Deletes a pet * - * @param int $pet_id Pet id to delete (required) - * @param string $api_key (optional) + * @param int $pet_id Pet id to delete (required) + * @param string $api_key (optional) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -346,8 +346,8 @@ public function deletePetWithHttpInfo($pet_id, $api_key = null) * * Deletes a pet * - * @param int $pet_id Pet id to delete (required) - * @param string $api_key (optional) + * @param int $pet_id Pet id to delete (required) + * @param string $api_key (optional) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -363,8 +363,8 @@ public function deletePetAsync($pet_id, $api_key = null) * * Deletes a pet * - * @param int $pet_id Pet id to delete (required) - * @param string $api_key (optional) + * @param int $pet_id Pet id to delete (required) + * @param string $api_key (optional) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -390,8 +390,8 @@ public function deletePetAsyncWithHttpInfo($pet_id, $api_key = null) /** * Create request for operation 'deletePet' * - * @param int $pet_id Pet id to delete (required) - * @param string $api_key (optional) + * @param int $pet_id Pet id to delete (required) + * @param string $api_key (optional) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -486,7 +486,7 @@ protected function deletePetRequest($pet_id, $api_key = null) * * Finds Pets by status * - * @param string[] $status Status values that need to be considered for filter (required) + * @param string[] $status Status values that need to be considered for filter (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\Pet[] @@ -502,7 +502,7 @@ public function findPetsByStatus($status) * * Finds Pets by status * - * @param string[] $status Status values that need to be considered for filter (required) + * @param string[] $status Status values that need to be considered for filter (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) @@ -567,7 +567,7 @@ public function findPetsByStatusWithHttpInfo($status) * * Finds Pets by status * - * @param string[] $status Status values that need to be considered for filter (required) + * @param string[] $status Status values that need to be considered for filter (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -583,7 +583,7 @@ public function findPetsByStatusAsync($status) * * Finds Pets by status * - * @param string[] $status Status values that need to be considered for filter (required) + * @param string[] $status Status values that need to be considered for filter (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -623,7 +623,7 @@ public function findPetsByStatusAsyncWithHttpInfo($status) /** * Create request for operation 'findPetsByStatus' * - * @param string[] $status Status values that need to be considered for filter (required) + * @param string[] $status Status values that need to be considered for filter (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -717,7 +717,7 @@ protected function findPetsByStatusRequest($status) * * Finds Pets by tags * - * @param string[] $tags Tags to filter by (required) + * @param string[] $tags Tags to filter by (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\Pet[] @@ -733,7 +733,7 @@ public function findPetsByTags($tags) * * Finds Pets by tags * - * @param string[] $tags Tags to filter by (required) + * @param string[] $tags Tags to filter by (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) @@ -798,7 +798,7 @@ public function findPetsByTagsWithHttpInfo($tags) * * Finds Pets by tags * - * @param string[] $tags Tags to filter by (required) + * @param string[] $tags Tags to filter by (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -814,7 +814,7 @@ public function findPetsByTagsAsync($tags) * * Finds Pets by tags * - * @param string[] $tags Tags to filter by (required) + * @param string[] $tags Tags to filter by (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -854,7 +854,7 @@ public function findPetsByTagsAsyncWithHttpInfo($tags) /** * Create request for operation 'findPetsByTags' * - * @param string[] $tags Tags to filter by (required) + * @param string[] $tags Tags to filter by (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -948,7 +948,7 @@ protected function findPetsByTagsRequest($tags) * * Find pet by ID * - * @param int $pet_id ID of pet to return (required) + * @param int $pet_id ID of pet to return (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\Pet @@ -964,7 +964,7 @@ public function getPetById($pet_id) * * Find pet by ID * - * @param int $pet_id ID of pet to return (required) + * @param int $pet_id ID of pet to return (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\Pet, HTTP status code, HTTP response headers (array of strings) @@ -1029,7 +1029,7 @@ public function getPetByIdWithHttpInfo($pet_id) * * Find pet by ID * - * @param int $pet_id ID of pet to return (required) + * @param int $pet_id ID of pet to return (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1045,7 +1045,7 @@ public function getPetByIdAsync($pet_id) * * Find pet by ID * - * @param int $pet_id ID of pet to return (required) + * @param int $pet_id ID of pet to return (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1085,7 +1085,7 @@ public function getPetByIdAsyncWithHttpInfo($pet_id) /** * Create request for operation 'getPetById' * - * @param int $pet_id ID of pet to return (required) + * @param int $pet_id ID of pet to return (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -1177,7 +1177,7 @@ protected function getPetByIdRequest($pet_id) * * Update an existing pet * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -1192,7 +1192,7 @@ public function updatePet($body) * * Update an existing pet * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -1239,7 +1239,7 @@ public function updatePetWithHttpInfo($body) * * Update an existing pet * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1255,7 +1255,7 @@ public function updatePetAsync($body) * * Update an existing pet * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1281,7 +1281,7 @@ public function updatePetAsyncWithHttpInfo($body) /** * Create request for operation 'updatePet' * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -1373,9 +1373,9 @@ protected function updatePetRequest($body) * * Updates a pet in the store with form data * - * @param int $pet_id ID of pet that needs to be updated (required) - * @param string $name Updated name of the pet (optional) - * @param string $status Updated status of the pet (optional) + * @param int $pet_id ID of pet that needs to be updated (required) + * @param string $name Updated name of the pet (optional) + * @param string $status Updated status of the pet (optional) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -1390,9 +1390,9 @@ public function updatePetWithForm($pet_id, $name = null, $status = null) * * Updates a pet in the store with form data * - * @param int $pet_id ID of pet that needs to be updated (required) - * @param string $name Updated name of the pet (optional) - * @param string $status Updated status of the pet (optional) + * @param int $pet_id ID of pet that needs to be updated (required) + * @param string $name Updated name of the pet (optional) + * @param string $status Updated status of the pet (optional) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -1439,9 +1439,9 @@ public function updatePetWithFormWithHttpInfo($pet_id, $name = null, $status = n * * Updates a pet in the store with form data * - * @param int $pet_id ID of pet that needs to be updated (required) - * @param string $name Updated name of the pet (optional) - * @param string $status Updated status of the pet (optional) + * @param int $pet_id ID of pet that needs to be updated (required) + * @param string $name Updated name of the pet (optional) + * @param string $status Updated status of the pet (optional) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1457,9 +1457,9 @@ public function updatePetWithFormAsync($pet_id, $name = null, $status = null) * * Updates a pet in the store with form data * - * @param int $pet_id ID of pet that needs to be updated (required) - * @param string $name Updated name of the pet (optional) - * @param string $status Updated status of the pet (optional) + * @param int $pet_id ID of pet that needs to be updated (required) + * @param string $name Updated name of the pet (optional) + * @param string $status Updated status of the pet (optional) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1485,9 +1485,9 @@ public function updatePetWithFormAsyncWithHttpInfo($pet_id, $name = null, $statu /** * Create request for operation 'updatePetWithForm' * - * @param int $pet_id ID of pet that needs to be updated (required) - * @param string $name Updated name of the pet (optional) - * @param string $status Updated status of the pet (optional) + * @param int $pet_id ID of pet that needs to be updated (required) + * @param string $name Updated name of the pet (optional) + * @param string $status Updated status of the pet (optional) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -1586,9 +1586,9 @@ protected function updatePetWithFormRequest($pet_id, $name = null, $status = nul * * uploads an image * - * @param int $pet_id ID of pet to update (required) - * @param string $additional_metadata Additional data to pass to server (optional) - * @param \SplFileObject $file file to upload (optional) + * @param int $pet_id ID of pet to update (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * @param \SplFileObject $file file to upload (optional) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\ApiResponse @@ -1604,9 +1604,9 @@ public function uploadFile($pet_id, $additional_metadata = null, $file = null) * * uploads an image * - * @param int $pet_id ID of pet to update (required) - * @param string $additional_metadata Additional data to pass to server (optional) - * @param \SplFileObject $file file to upload (optional) + * @param int $pet_id ID of pet to update (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * @param \SplFileObject $file file to upload (optional) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings) @@ -1671,9 +1671,9 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi * * uploads an image * - * @param int $pet_id ID of pet to update (required) - * @param string $additional_metadata Additional data to pass to server (optional) - * @param \SplFileObject $file file to upload (optional) + * @param int $pet_id ID of pet to update (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * @param \SplFileObject $file file to upload (optional) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1689,9 +1689,9 @@ public function uploadFileAsync($pet_id, $additional_metadata = null, $file = nu * * uploads an image * - * @param int $pet_id ID of pet to update (required) - * @param string $additional_metadata Additional data to pass to server (optional) - * @param \SplFileObject $file file to upload (optional) + * @param int $pet_id ID of pet to update (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * @param \SplFileObject $file file to upload (optional) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1731,9 +1731,9 @@ public function uploadFileAsyncWithHttpInfo($pet_id, $additional_metadata = null /** * Create request for operation 'uploadFile' * - * @param int $pet_id ID of pet to update (required) - * @param string $additional_metadata Additional data to pass to server (optional) - * @param \SplFileObject $file file to upload (optional) + * @param int $pet_id ID of pet to update (required) + * @param string $additional_metadata Additional data to pass to server (optional) + * @param \SplFileObject $file file to upload (optional) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php index 56ad01aa62f..be5c10c75ce 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -60,8 +60,8 @@ class StoreApi /** * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector + * @param Configuration $config + * @param HeaderSelector $selector */ public function __construct( ClientInterface $client = null, @@ -86,7 +86,7 @@ public function getConfig() * * Delete purchase order by ID * - * @param string $order_id ID of the order that needs to be deleted (required) + * @param string $order_id ID of the order that needs to be deleted (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -101,7 +101,7 @@ public function deleteOrder($order_id) * * Delete purchase order by ID * - * @param string $order_id ID of the order that needs to be deleted (required) + * @param string $order_id ID of the order that needs to be deleted (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -148,7 +148,7 @@ public function deleteOrderWithHttpInfo($order_id) * * Delete purchase order by ID * - * @param string $order_id ID of the order that needs to be deleted (required) + * @param string $order_id ID of the order that needs to be deleted (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -164,7 +164,7 @@ public function deleteOrderAsync($order_id) * * Delete purchase order by ID * - * @param string $order_id ID of the order that needs to be deleted (required) + * @param string $order_id ID of the order that needs to be deleted (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -190,7 +190,7 @@ public function deleteOrderAsyncWithHttpInfo($order_id) /** * Create request for operation 'deleteOrder' * - * @param string $order_id ID of the order that needs to be deleted (required) + * @param string $order_id ID of the order that needs to be deleted (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -493,7 +493,7 @@ protected function getInventoryRequest() * * Find purchase order by ID * - * @param int $order_id ID of pet that needs to be fetched (required) + * @param int $order_id ID of pet that needs to be fetched (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\Order @@ -509,7 +509,7 @@ public function getOrderById($order_id) * * Find purchase order by ID * - * @param int $order_id ID of pet that needs to be fetched (required) + * @param int $order_id ID of pet that needs to be fetched (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) @@ -574,7 +574,7 @@ public function getOrderByIdWithHttpInfo($order_id) * * Find purchase order by ID * - * @param int $order_id ID of pet that needs to be fetched (required) + * @param int $order_id ID of pet that needs to be fetched (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -590,7 +590,7 @@ public function getOrderByIdAsync($order_id) * * Find purchase order by ID * - * @param int $order_id ID of pet that needs to be fetched (required) + * @param int $order_id ID of pet that needs to be fetched (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -630,7 +630,7 @@ public function getOrderByIdAsyncWithHttpInfo($order_id) /** * Create request for operation 'getOrderById' * - * @param int $order_id ID of pet that needs to be fetched (required) + * @param int $order_id ID of pet that needs to be fetched (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -724,7 +724,7 @@ protected function getOrderByIdRequest($order_id) * * Place an order for a pet * - * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) + * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\Order @@ -740,7 +740,7 @@ public function placeOrder($body) * * Place an order for a pet * - * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) + * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) @@ -805,7 +805,7 @@ public function placeOrderWithHttpInfo($body) * * Place an order for a pet * - * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) + * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -821,7 +821,7 @@ public function placeOrderAsync($body) * * Place an order for a pet * - * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) + * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -861,7 +861,7 @@ public function placeOrderAsyncWithHttpInfo($body) /** * Create request for operation 'placeOrder' * - * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) + * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php index 27f7220ed8a..ee3046f533c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -60,8 +60,8 @@ class UserApi /** * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector + * @param Configuration $config + * @param HeaderSelector $selector */ public function __construct( ClientInterface $client = null, @@ -86,7 +86,7 @@ public function getConfig() * * Create user * - * @param \Swagger\Client\Model\User $body Created user object (required) + * @param \Swagger\Client\Model\User $body Created user object (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -101,7 +101,7 @@ public function createUser($body) * * Create user * - * @param \Swagger\Client\Model\User $body Created user object (required) + * @param \Swagger\Client\Model\User $body Created user object (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -148,7 +148,7 @@ public function createUserWithHttpInfo($body) * * Create user * - * @param \Swagger\Client\Model\User $body Created user object (required) + * @param \Swagger\Client\Model\User $body Created user object (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -164,7 +164,7 @@ public function createUserAsync($body) * * Create user * - * @param \Swagger\Client\Model\User $body Created user object (required) + * @param \Swagger\Client\Model\User $body Created user object (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -190,7 +190,7 @@ public function createUserAsyncWithHttpInfo($body) /** * Create request for operation 'createUser' * - * @param \Swagger\Client\Model\User $body Created user object (required) + * @param \Swagger\Client\Model\User $body Created user object (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -278,7 +278,7 @@ protected function createUserRequest($body) * * Creates list of users with given input array * - * @param \Swagger\Client\Model\User[] $body List of user object (required) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -293,7 +293,7 @@ public function createUsersWithArrayInput($body) * * Creates list of users with given input array * - * @param \Swagger\Client\Model\User[] $body List of user object (required) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -340,7 +340,7 @@ public function createUsersWithArrayInputWithHttpInfo($body) * * Creates list of users with given input array * - * @param \Swagger\Client\Model\User[] $body List of user object (required) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -356,7 +356,7 @@ public function createUsersWithArrayInputAsync($body) * * Creates list of users with given input array * - * @param \Swagger\Client\Model\User[] $body List of user object (required) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -382,7 +382,7 @@ public function createUsersWithArrayInputAsyncWithHttpInfo($body) /** * Create request for operation 'createUsersWithArrayInput' * - * @param \Swagger\Client\Model\User[] $body List of user object (required) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -470,7 +470,7 @@ protected function createUsersWithArrayInputRequest($body) * * Creates list of users with given input array * - * @param \Swagger\Client\Model\User[] $body List of user object (required) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -485,7 +485,7 @@ public function createUsersWithListInput($body) * * Creates list of users with given input array * - * @param \Swagger\Client\Model\User[] $body List of user object (required) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -532,7 +532,7 @@ public function createUsersWithListInputWithHttpInfo($body) * * Creates list of users with given input array * - * @param \Swagger\Client\Model\User[] $body List of user object (required) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -548,7 +548,7 @@ public function createUsersWithListInputAsync($body) * * Creates list of users with given input array * - * @param \Swagger\Client\Model\User[] $body List of user object (required) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -574,7 +574,7 @@ public function createUsersWithListInputAsyncWithHttpInfo($body) /** * Create request for operation 'createUsersWithListInput' * - * @param \Swagger\Client\Model\User[] $body List of user object (required) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -662,7 +662,7 @@ protected function createUsersWithListInputRequest($body) * * Delete user * - * @param string $username The name that needs to be deleted (required) + * @param string $username The name that needs to be deleted (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -677,7 +677,7 @@ public function deleteUser($username) * * Delete user * - * @param string $username The name that needs to be deleted (required) + * @param string $username The name that needs to be deleted (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -724,7 +724,7 @@ public function deleteUserWithHttpInfo($username) * * Delete user * - * @param string $username The name that needs to be deleted (required) + * @param string $username The name that needs to be deleted (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -740,7 +740,7 @@ public function deleteUserAsync($username) * * Delete user * - * @param string $username The name that needs to be deleted (required) + * @param string $username The name that needs to be deleted (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -766,7 +766,7 @@ public function deleteUserAsyncWithHttpInfo($username) /** * Create request for operation 'deleteUser' * - * @param string $username The name that needs to be deleted (required) + * @param string $username The name that needs to be deleted (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -853,7 +853,7 @@ protected function deleteUserRequest($username) * * Get user by user name * - * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * @param string $username The name that needs to be fetched. Use user1 for testing. (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\User @@ -869,7 +869,7 @@ public function getUserByName($username) * * Get user by user name * - * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * @param string $username The name that needs to be fetched. Use user1 for testing. (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\User, HTTP status code, HTTP response headers (array of strings) @@ -934,7 +934,7 @@ public function getUserByNameWithHttpInfo($username) * * Get user by user name * - * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * @param string $username The name that needs to be fetched. Use user1 for testing. (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -950,7 +950,7 @@ public function getUserByNameAsync($username) * * Get user by user name * - * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * @param string $username The name that needs to be fetched. Use user1 for testing. (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -990,7 +990,7 @@ public function getUserByNameAsyncWithHttpInfo($username) /** * Create request for operation 'getUserByName' * - * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * @param string $username The name that needs to be fetched. Use user1 for testing. (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -1077,8 +1077,8 @@ protected function getUserByNameRequest($username) * * Logs user into the system * - * @param string $username The user name for login (required) - * @param string $password The password for login in clear text (required) + * @param string $username The user name for login (required) + * @param string $password The password for login in clear text (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return string @@ -1094,8 +1094,8 @@ public function loginUser($username, $password) * * Logs user into the system * - * @param string $username The user name for login (required) - * @param string $password The password for login in clear text (required) + * @param string $username The user name for login (required) + * @param string $password The password for login in clear text (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) @@ -1160,8 +1160,8 @@ public function loginUserWithHttpInfo($username, $password) * * Logs user into the system * - * @param string $username The user name for login (required) - * @param string $password The password for login in clear text (required) + * @param string $username The user name for login (required) + * @param string $password The password for login in clear text (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1177,8 +1177,8 @@ public function loginUserAsync($username, $password) * * Logs user into the system * - * @param string $username The user name for login (required) - * @param string $password The password for login in clear text (required) + * @param string $username The user name for login (required) + * @param string $password The password for login in clear text (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1218,8 +1218,8 @@ public function loginUserAsyncWithHttpInfo($username, $password) /** * Create request for operation 'loginUser' * - * @param string $username The user name for login (required) - * @param string $password The password for login in clear text (required) + * @param string $username The user name for login (required) + * @param string $password The password for login in clear text (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -1492,8 +1492,8 @@ protected function logoutUserRequest() * * Updated user * - * @param string $username name that need to be deleted (required) - * @param \Swagger\Client\Model\User $body Updated user object (required) + * @param string $username name that need to be deleted (required) + * @param \Swagger\Client\Model\User $body Updated user object (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -1508,8 +1508,8 @@ public function updateUser($username, $body) * * Updated user * - * @param string $username name that need to be deleted (required) - * @param \Swagger\Client\Model\User $body Updated user object (required) + * @param string $username name that need to be deleted (required) + * @param \Swagger\Client\Model\User $body Updated user object (required) * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -1556,8 +1556,8 @@ public function updateUserWithHttpInfo($username, $body) * * Updated user * - * @param string $username name that need to be deleted (required) - * @param \Swagger\Client\Model\User $body Updated user object (required) + * @param string $username name that need to be deleted (required) + * @param \Swagger\Client\Model\User $body Updated user object (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1573,8 +1573,8 @@ public function updateUserAsync($username, $body) * * Updated user * - * @param string $username name that need to be deleted (required) - * @param \Swagger\Client\Model\User $body Updated user object (required) + * @param string $username name that need to be deleted (required) + * @param \Swagger\Client\Model\User $body Updated user object (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1600,8 +1600,8 @@ public function updateUserAsyncWithHttpInfo($username, $body) /** * Create request for operation 'updateUser' * - * @param string $username name that need to be deleted (required) - * @param \Swagger\Client\Model\User $body Updated user object (required) + * @param string $username name that need to be deleted (required) + * @param \Swagger\Client\Model\User $body Updated user object (required) * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php index 4ddb24ba866..1e0bd1a5be9 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -299,10 +299,6 @@ public function listInvalidProperties() if ($this->container['byte'] === null) { $invalid_properties[] = "'byte' can't be null"; } - if (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $this->container['byte'])) { - $invalid_properties[] = "invalid value for 'byte', must be conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."; - } - if ($this->container['date'] === null) { $invalid_properties[] = "'date' can't be null"; } @@ -368,9 +364,6 @@ public function valid() if ($this->container['byte'] === null) { return false; } - if (!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $this->container['byte'])) { - return false; - } if ($this->container['date'] === null) { return false; } @@ -595,11 +588,6 @@ public function getByte() */ public function setByte($byte) { - - if ((!preg_match("/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/", $byte))) { - throw new \InvalidArgumentException("invalid value for $byte when calling FormatTest., must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/."); - } - $this->container['byte'] = $byte; return $this; diff --git a/samples/client/petstore/php/SwaggerClient-php/test/Api/Fake_classname_tags123ApiTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Api/Fake_classname_tags123ApiTest.php new file mode 100644 index 00000000000..b9b64aeca97 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/test/Api/Fake_classname_tags123ApiTest.php @@ -0,0 +1,83 @@ + Date: Sat, 16 Sep 2017 13:26:17 +0900 Subject: [PATCH 2/5] Improve grouping of parameter tags --- .../src/main/resources/php/api.mustache | 5 +++ .../php/SwaggerClient-php/lib/Api/FakeApi.php | 5 +++ .../lib/Api/AnotherFakeApi.php | 5 +++ .../php/SwaggerClient-php/lib/Api/FakeApi.php | 40 +++++++++++++++++++ .../lib/Api/Fake_classname_tags123Api.php | 5 +++ .../php/SwaggerClient-php/lib/Api/PetApi.php | 40 +++++++++++++++++++ .../SwaggerClient-php/lib/Api/StoreApi.php | 20 ++++++++++ .../php/SwaggerClient-php/lib/Api/UserApi.php | 40 +++++++++++++++++++ 8 files changed, 160 insertions(+) diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index b4440213240..94e31cdd07b 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -86,6 +86,7 @@ use {{invokerPackage}}\ObjectSerializer; {{#allParams}} * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} {{/allParams}} + * * @throws \{{invokerPackage}}\ApiException on non-2xx response * @throws \InvalidArgumentException * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} @@ -110,6 +111,7 @@ use {{invokerPackage}}\ObjectSerializer; {{#allParams}} * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} {{/allParams}} + * * @throws \{{invokerPackage}}\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) @@ -190,6 +192,7 @@ use {{invokerPackage}}\ObjectSerializer; {{#allParams}} * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} {{/allParams}} + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -212,6 +215,7 @@ use {{invokerPackage}}\ObjectSerializer; {{#allParams}} * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} {{/allParams}} + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -259,6 +263,7 @@ use {{invokerPackage}}\ObjectSerializer; {{#allParams}} * @param {{dataType}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} {{/allParams}} + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php index d62ba12d2e8..cc80c3adfe2 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -87,6 +87,7 @@ public function getConfig() * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -102,6 +103,7 @@ public function testCodeInjectEndRnNR($test_code_inject____end____rn_n_r = null) * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -149,6 +151,7 @@ public function testCodeInjectEndRnNRWithHttpInfo($test_code_inject____end____rn * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -165,6 +168,7 @@ public function testCodeInjectEndRnNRAsync($test_code_inject____end____rn_n_r = * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -191,6 +195,7 @@ public function testCodeInjectEndRnNRAsyncWithHttpInfo($test_code_inject____end_ * Create request for operation 'testCodeInjectEndRnNR' * * @param string $test_code_inject____end____rn_n_r To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/AnotherFakeApi.php index ed5bda8a420..3f42243f107 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/AnotherFakeApi.php @@ -87,6 +87,7 @@ public function getConfig() * To test special tags * * @param \Swagger\Client\Model\Client $body client model (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\Client @@ -103,6 +104,7 @@ public function testSpecialTags($body) * To test special tags * * @param \Swagger\Client\Model\Client $body client model (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\Client, HTTP status code, HTTP response headers (array of strings) @@ -168,6 +170,7 @@ public function testSpecialTagsWithHttpInfo($body) * To test special tags * * @param \Swagger\Client\Model\Client $body client model (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -184,6 +187,7 @@ public function testSpecialTagsAsync($body) * To test special tags * * @param \Swagger\Client\Model\Client $body client model (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -224,6 +228,7 @@ public function testSpecialTagsAsyncWithHttpInfo($body) * Create request for operation 'testSpecialTags' * * @param \Swagger\Client\Model\Client $body client model (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index 82ce0ca537e..9b2a9c1a9d2 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -85,6 +85,7 @@ public function getConfig() * Operation fakeOuterBooleanSerialize * * @param \Swagger\Client\Model\OuterBoolean $body Input boolean as post body (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\OuterBoolean @@ -99,6 +100,7 @@ public function fakeOuterBooleanSerialize($body = null) * Operation fakeOuterBooleanSerializeWithHttpInfo * * @param \Swagger\Client\Model\OuterBoolean $body Input boolean as post body (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\OuterBoolean, HTTP status code, HTTP response headers (array of strings) @@ -164,6 +166,7 @@ public function fakeOuterBooleanSerializeWithHttpInfo($body = null) * * * @param \Swagger\Client\Model\OuterBoolean $body Input boolean as post body (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -180,6 +183,7 @@ public function fakeOuterBooleanSerializeAsync($body = null) * * * @param \Swagger\Client\Model\OuterBoolean $body Input boolean as post body (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -220,6 +224,7 @@ public function fakeOuterBooleanSerializeAsyncWithHttpInfo($body = null) * Create request for operation 'fakeOuterBooleanSerialize' * * @param \Swagger\Client\Model\OuterBoolean $body Input boolean as post body (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -302,6 +307,7 @@ protected function fakeOuterBooleanSerializeRequest($body = null) * Operation fakeOuterCompositeSerialize * * @param \Swagger\Client\Model\OuterComposite $body Input composite as post body (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\OuterComposite @@ -316,6 +322,7 @@ public function fakeOuterCompositeSerialize($body = null) * Operation fakeOuterCompositeSerializeWithHttpInfo * * @param \Swagger\Client\Model\OuterComposite $body Input composite as post body (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\OuterComposite, HTTP status code, HTTP response headers (array of strings) @@ -381,6 +388,7 @@ public function fakeOuterCompositeSerializeWithHttpInfo($body = null) * * * @param \Swagger\Client\Model\OuterComposite $body Input composite as post body (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -397,6 +405,7 @@ public function fakeOuterCompositeSerializeAsync($body = null) * * * @param \Swagger\Client\Model\OuterComposite $body Input composite as post body (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -437,6 +446,7 @@ public function fakeOuterCompositeSerializeAsyncWithHttpInfo($body = null) * Create request for operation 'fakeOuterCompositeSerialize' * * @param \Swagger\Client\Model\OuterComposite $body Input composite as post body (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -519,6 +529,7 @@ protected function fakeOuterCompositeSerializeRequest($body = null) * Operation fakeOuterNumberSerialize * * @param \Swagger\Client\Model\OuterNumber $body Input number as post body (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\OuterNumber @@ -533,6 +544,7 @@ public function fakeOuterNumberSerialize($body = null) * Operation fakeOuterNumberSerializeWithHttpInfo * * @param \Swagger\Client\Model\OuterNumber $body Input number as post body (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\OuterNumber, HTTP status code, HTTP response headers (array of strings) @@ -598,6 +610,7 @@ public function fakeOuterNumberSerializeWithHttpInfo($body = null) * * * @param \Swagger\Client\Model\OuterNumber $body Input number as post body (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -614,6 +627,7 @@ public function fakeOuterNumberSerializeAsync($body = null) * * * @param \Swagger\Client\Model\OuterNumber $body Input number as post body (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -654,6 +668,7 @@ public function fakeOuterNumberSerializeAsyncWithHttpInfo($body = null) * Create request for operation 'fakeOuterNumberSerialize' * * @param \Swagger\Client\Model\OuterNumber $body Input number as post body (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -736,6 +751,7 @@ protected function fakeOuterNumberSerializeRequest($body = null) * Operation fakeOuterStringSerialize * * @param \Swagger\Client\Model\OuterString $body Input string as post body (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\OuterString @@ -750,6 +766,7 @@ public function fakeOuterStringSerialize($body = null) * Operation fakeOuterStringSerializeWithHttpInfo * * @param \Swagger\Client\Model\OuterString $body Input string as post body (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\OuterString, HTTP status code, HTTP response headers (array of strings) @@ -815,6 +832,7 @@ public function fakeOuterStringSerializeWithHttpInfo($body = null) * * * @param \Swagger\Client\Model\OuterString $body Input string as post body (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -831,6 +849,7 @@ public function fakeOuterStringSerializeAsync($body = null) * * * @param \Swagger\Client\Model\OuterString $body Input string as post body (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -871,6 +890,7 @@ public function fakeOuterStringSerializeAsyncWithHttpInfo($body = null) * Create request for operation 'fakeOuterStringSerialize' * * @param \Swagger\Client\Model\OuterString $body Input string as post body (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -955,6 +975,7 @@ protected function fakeOuterStringSerializeRequest($body = null) * To test \"client\" model * * @param \Swagger\Client\Model\Client $body client model (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\Client @@ -971,6 +992,7 @@ public function testClientModel($body) * To test \"client\" model * * @param \Swagger\Client\Model\Client $body client model (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\Client, HTTP status code, HTTP response headers (array of strings) @@ -1036,6 +1058,7 @@ public function testClientModelWithHttpInfo($body) * To test \"client\" model * * @param \Swagger\Client\Model\Client $body client model (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1052,6 +1075,7 @@ public function testClientModelAsync($body) * To test \"client\" model * * @param \Swagger\Client\Model\Client $body client model (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1092,6 +1116,7 @@ public function testClientModelAsyncWithHttpInfo($body) * Create request for operation 'testClientModel' * * @param \Swagger\Client\Model\Client $body client model (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -1193,6 +1218,7 @@ protected function testClientModelRequest($body) * @param \DateTime $date_time None (optional) * @param string $password None (optional) * @param string $callback None (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -1221,6 +1247,7 @@ public function testEndpointParameters($number, $double, $pattern_without_delimi * @param \DateTime $date_time None (optional) * @param string $password None (optional) * @param string $callback None (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -1281,6 +1308,7 @@ public function testEndpointParametersWithHttpInfo($number, $double, $pattern_wi * @param \DateTime $date_time None (optional) * @param string $password None (optional) * @param string $callback None (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1310,6 +1338,7 @@ public function testEndpointParametersAsync($number, $double, $pattern_without_d * @param \DateTime $date_time None (optional) * @param string $password None (optional) * @param string $callback None (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1349,6 +1378,7 @@ public function testEndpointParametersAsyncWithHttpInfo($number, $double, $patte * @param \DateTime $date_time None (optional) * @param string $password None (optional) * @param string $callback None (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -1558,6 +1588,7 @@ protected function testEndpointParametersRequest($number, $double, $pattern_with * @param string $enum_query_string Query parameter enum test (string) (optional, default to -efg) * @param int $enum_query_integer Query parameter enum test (double) (optional) * @param double $enum_query_double Query parameter enum test (double) (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -1580,6 +1611,7 @@ public function testEnumParameters($enum_form_string_array = null, $enum_form_st * @param string $enum_query_string Query parameter enum test (string) (optional, default to -efg) * @param int $enum_query_integer Query parameter enum test (double) (optional) * @param double $enum_query_double Query parameter enum test (double) (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -1634,6 +1666,7 @@ public function testEnumParametersWithHttpInfo($enum_form_string_array = null, $ * @param string $enum_query_string Query parameter enum test (string) (optional, default to -efg) * @param int $enum_query_integer Query parameter enum test (double) (optional) * @param double $enum_query_double Query parameter enum test (double) (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1657,6 +1690,7 @@ public function testEnumParametersAsync($enum_form_string_array = null, $enum_fo * @param string $enum_query_string Query parameter enum test (string) (optional, default to -efg) * @param int $enum_query_integer Query parameter enum test (double) (optional) * @param double $enum_query_double Query parameter enum test (double) (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1690,6 +1724,7 @@ public function testEnumParametersAsyncWithHttpInfo($enum_form_string_array = nu * @param string $enum_query_string Query parameter enum test (string) (optional, default to -efg) * @param int $enum_query_integer Query parameter enum test (double) (optional) * @param double $enum_query_double Query parameter enum test (double) (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -1808,6 +1843,7 @@ protected function testEnumParametersRequest($enum_form_string_array = null, $en * * @param string $param field1 (required) * @param string $param2 field2 (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -1824,6 +1860,7 @@ public function testJsonFormData($param, $param2) * * @param string $param field1 (required) * @param string $param2 field2 (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -1872,6 +1909,7 @@ public function testJsonFormDataWithHttpInfo($param, $param2) * * @param string $param field1 (required) * @param string $param2 field2 (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1889,6 +1927,7 @@ public function testJsonFormDataAsync($param, $param2) * * @param string $param field1 (required) * @param string $param2 field2 (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1916,6 +1955,7 @@ public function testJsonFormDataAsyncWithHttpInfo($param, $param2) * * @param string $param field1 (required) * @param string $param2 field2 (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/Fake_classname_tags123Api.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/Fake_classname_tags123Api.php index d00082061c4..a8dd23d9b82 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/Fake_classname_tags123Api.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/Fake_classname_tags123Api.php @@ -87,6 +87,7 @@ public function getConfig() * To test class name in snake case * * @param \Swagger\Client\Model\Client $body client model (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\Client @@ -103,6 +104,7 @@ public function testClassname($body) * To test class name in snake case * * @param \Swagger\Client\Model\Client $body client model (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\Client, HTTP status code, HTTP response headers (array of strings) @@ -168,6 +170,7 @@ public function testClassnameWithHttpInfo($body) * To test class name in snake case * * @param \Swagger\Client\Model\Client $body client model (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -184,6 +187,7 @@ public function testClassnameAsync($body) * To test class name in snake case * * @param \Swagger\Client\Model\Client $body client model (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -224,6 +228,7 @@ public function testClassnameAsyncWithHttpInfo($body) * Create request for operation 'testClassname' * * @param \Swagger\Client\Model\Client $body client model (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php index 30773ab34a8..47b4ae269bc 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -87,6 +87,7 @@ public function getConfig() * Add a new pet to the store * * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -102,6 +103,7 @@ public function addPet($body) * Add a new pet to the store * * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -149,6 +151,7 @@ public function addPetWithHttpInfo($body) * Add a new pet to the store * * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -165,6 +168,7 @@ public function addPetAsync($body) * Add a new pet to the store * * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -191,6 +195,7 @@ public function addPetAsyncWithHttpInfo($body) * Create request for operation 'addPet' * * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -284,6 +289,7 @@ protected function addPetRequest($body) * * @param int $pet_id Pet id to delete (required) * @param string $api_key (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -300,6 +306,7 @@ public function deletePet($pet_id, $api_key = null) * * @param int $pet_id Pet id to delete (required) * @param string $api_key (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -348,6 +355,7 @@ public function deletePetWithHttpInfo($pet_id, $api_key = null) * * @param int $pet_id Pet id to delete (required) * @param string $api_key (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -365,6 +373,7 @@ public function deletePetAsync($pet_id, $api_key = null) * * @param int $pet_id Pet id to delete (required) * @param string $api_key (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -392,6 +401,7 @@ public function deletePetAsyncWithHttpInfo($pet_id, $api_key = null) * * @param int $pet_id Pet id to delete (required) * @param string $api_key (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -487,6 +497,7 @@ protected function deletePetRequest($pet_id, $api_key = null) * Finds Pets by status * * @param string[] $status Status values that need to be considered for filter (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\Pet[] @@ -503,6 +514,7 @@ public function findPetsByStatus($status) * Finds Pets by status * * @param string[] $status Status values that need to be considered for filter (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) @@ -568,6 +580,7 @@ public function findPetsByStatusWithHttpInfo($status) * Finds Pets by status * * @param string[] $status Status values that need to be considered for filter (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -584,6 +597,7 @@ public function findPetsByStatusAsync($status) * Finds Pets by status * * @param string[] $status Status values that need to be considered for filter (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -624,6 +638,7 @@ public function findPetsByStatusAsyncWithHttpInfo($status) * Create request for operation 'findPetsByStatus' * * @param string[] $status Status values that need to be considered for filter (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -718,6 +733,7 @@ protected function findPetsByStatusRequest($status) * Finds Pets by tags * * @param string[] $tags Tags to filter by (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\Pet[] @@ -734,6 +750,7 @@ public function findPetsByTags($tags) * Finds Pets by tags * * @param string[] $tags Tags to filter by (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) @@ -799,6 +816,7 @@ public function findPetsByTagsWithHttpInfo($tags) * Finds Pets by tags * * @param string[] $tags Tags to filter by (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -815,6 +833,7 @@ public function findPetsByTagsAsync($tags) * Finds Pets by tags * * @param string[] $tags Tags to filter by (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -855,6 +874,7 @@ public function findPetsByTagsAsyncWithHttpInfo($tags) * Create request for operation 'findPetsByTags' * * @param string[] $tags Tags to filter by (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -949,6 +969,7 @@ protected function findPetsByTagsRequest($tags) * Find pet by ID * * @param int $pet_id ID of pet to return (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\Pet @@ -965,6 +986,7 @@ public function getPetById($pet_id) * Find pet by ID * * @param int $pet_id ID of pet to return (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\Pet, HTTP status code, HTTP response headers (array of strings) @@ -1030,6 +1052,7 @@ public function getPetByIdWithHttpInfo($pet_id) * Find pet by ID * * @param int $pet_id ID of pet to return (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1046,6 +1069,7 @@ public function getPetByIdAsync($pet_id) * Find pet by ID * * @param int $pet_id ID of pet to return (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1086,6 +1110,7 @@ public function getPetByIdAsyncWithHttpInfo($pet_id) * Create request for operation 'getPetById' * * @param int $pet_id ID of pet to return (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -1178,6 +1203,7 @@ protected function getPetByIdRequest($pet_id) * Update an existing pet * * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -1193,6 +1219,7 @@ public function updatePet($body) * Update an existing pet * * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -1240,6 +1267,7 @@ public function updatePetWithHttpInfo($body) * Update an existing pet * * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1256,6 +1284,7 @@ public function updatePetAsync($body) * Update an existing pet * * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1282,6 +1311,7 @@ public function updatePetAsyncWithHttpInfo($body) * Create request for operation 'updatePet' * * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -1376,6 +1406,7 @@ protected function updatePetRequest($body) * @param int $pet_id ID of pet that needs to be updated (required) * @param string $name Updated name of the pet (optional) * @param string $status Updated status of the pet (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -1393,6 +1424,7 @@ public function updatePetWithForm($pet_id, $name = null, $status = null) * @param int $pet_id ID of pet that needs to be updated (required) * @param string $name Updated name of the pet (optional) * @param string $status Updated status of the pet (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -1442,6 +1474,7 @@ public function updatePetWithFormWithHttpInfo($pet_id, $name = null, $status = n * @param int $pet_id ID of pet that needs to be updated (required) * @param string $name Updated name of the pet (optional) * @param string $status Updated status of the pet (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1460,6 +1493,7 @@ public function updatePetWithFormAsync($pet_id, $name = null, $status = null) * @param int $pet_id ID of pet that needs to be updated (required) * @param string $name Updated name of the pet (optional) * @param string $status Updated status of the pet (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1488,6 +1522,7 @@ public function updatePetWithFormAsyncWithHttpInfo($pet_id, $name = null, $statu * @param int $pet_id ID of pet that needs to be updated (required) * @param string $name Updated name of the pet (optional) * @param string $status Updated status of the pet (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -1589,6 +1624,7 @@ protected function updatePetWithFormRequest($pet_id, $name = null, $status = nul * @param int $pet_id ID of pet to update (required) * @param string $additional_metadata Additional data to pass to server (optional) * @param \SplFileObject $file file to upload (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\ApiResponse @@ -1607,6 +1643,7 @@ public function uploadFile($pet_id, $additional_metadata = null, $file = null) * @param int $pet_id ID of pet to update (required) * @param string $additional_metadata Additional data to pass to server (optional) * @param \SplFileObject $file file to upload (optional) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings) @@ -1674,6 +1711,7 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi * @param int $pet_id ID of pet to update (required) * @param string $additional_metadata Additional data to pass to server (optional) * @param \SplFileObject $file file to upload (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1692,6 +1730,7 @@ public function uploadFileAsync($pet_id, $additional_metadata = null, $file = nu * @param int $pet_id ID of pet to update (required) * @param string $additional_metadata Additional data to pass to server (optional) * @param \SplFileObject $file file to upload (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1734,6 +1773,7 @@ public function uploadFileAsyncWithHttpInfo($pet_id, $additional_metadata = null * @param int $pet_id ID of pet to update (required) * @param string $additional_metadata Additional data to pass to server (optional) * @param \SplFileObject $file file to upload (optional) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php index be5c10c75ce..64a19ed7a4a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -87,6 +87,7 @@ public function getConfig() * Delete purchase order by ID * * @param string $order_id ID of the order that needs to be deleted (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -102,6 +103,7 @@ public function deleteOrder($order_id) * Delete purchase order by ID * * @param string $order_id ID of the order that needs to be deleted (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -149,6 +151,7 @@ public function deleteOrderWithHttpInfo($order_id) * Delete purchase order by ID * * @param string $order_id ID of the order that needs to be deleted (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -165,6 +168,7 @@ public function deleteOrderAsync($order_id) * Delete purchase order by ID * * @param string $order_id ID of the order that needs to be deleted (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -191,6 +195,7 @@ public function deleteOrderAsyncWithHttpInfo($order_id) * Create request for operation 'deleteOrder' * * @param string $order_id ID of the order that needs to be deleted (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -277,6 +282,7 @@ protected function deleteOrderRequest($order_id) * * Returns pet inventories by status * + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return map[string,int] @@ -292,6 +298,7 @@ public function getInventory() * * Returns pet inventories by status * + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of map[string,int], HTTP status code, HTTP response headers (array of strings) @@ -356,6 +363,7 @@ public function getInventoryWithHttpInfo() * * Returns pet inventories by status * + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -371,6 +379,7 @@ public function getInventoryAsync() * * Returns pet inventories by status * + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -410,6 +419,7 @@ public function getInventoryAsyncWithHttpInfo() /** * Create request for operation 'getInventory' * + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -494,6 +504,7 @@ protected function getInventoryRequest() * Find purchase order by ID * * @param int $order_id ID of pet that needs to be fetched (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\Order @@ -510,6 +521,7 @@ public function getOrderById($order_id) * Find purchase order by ID * * @param int $order_id ID of pet that needs to be fetched (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) @@ -575,6 +587,7 @@ public function getOrderByIdWithHttpInfo($order_id) * Find purchase order by ID * * @param int $order_id ID of pet that needs to be fetched (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -591,6 +604,7 @@ public function getOrderByIdAsync($order_id) * Find purchase order by ID * * @param int $order_id ID of pet that needs to be fetched (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -631,6 +645,7 @@ public function getOrderByIdAsyncWithHttpInfo($order_id) * Create request for operation 'getOrderById' * * @param int $order_id ID of pet that needs to be fetched (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -725,6 +740,7 @@ protected function getOrderByIdRequest($order_id) * Place an order for a pet * * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\Order @@ -741,6 +757,7 @@ public function placeOrder($body) * Place an order for a pet * * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) @@ -806,6 +823,7 @@ public function placeOrderWithHttpInfo($body) * Place an order for a pet * * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -822,6 +840,7 @@ public function placeOrderAsync($body) * Place an order for a pet * * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -862,6 +881,7 @@ public function placeOrderAsyncWithHttpInfo($body) * Create request for operation 'placeOrder' * * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php index ee3046f533c..99f30baebfd 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -87,6 +87,7 @@ public function getConfig() * Create user * * @param \Swagger\Client\Model\User $body Created user object (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -102,6 +103,7 @@ public function createUser($body) * Create user * * @param \Swagger\Client\Model\User $body Created user object (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -149,6 +151,7 @@ public function createUserWithHttpInfo($body) * Create user * * @param \Swagger\Client\Model\User $body Created user object (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -165,6 +168,7 @@ public function createUserAsync($body) * Create user * * @param \Swagger\Client\Model\User $body Created user object (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -191,6 +195,7 @@ public function createUserAsyncWithHttpInfo($body) * Create request for operation 'createUser' * * @param \Swagger\Client\Model\User $body Created user object (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -279,6 +284,7 @@ protected function createUserRequest($body) * Creates list of users with given input array * * @param \Swagger\Client\Model\User[] $body List of user object (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -294,6 +300,7 @@ public function createUsersWithArrayInput($body) * Creates list of users with given input array * * @param \Swagger\Client\Model\User[] $body List of user object (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -341,6 +348,7 @@ public function createUsersWithArrayInputWithHttpInfo($body) * Creates list of users with given input array * * @param \Swagger\Client\Model\User[] $body List of user object (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -357,6 +365,7 @@ public function createUsersWithArrayInputAsync($body) * Creates list of users with given input array * * @param \Swagger\Client\Model\User[] $body List of user object (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -383,6 +392,7 @@ public function createUsersWithArrayInputAsyncWithHttpInfo($body) * Create request for operation 'createUsersWithArrayInput' * * @param \Swagger\Client\Model\User[] $body List of user object (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -471,6 +481,7 @@ protected function createUsersWithArrayInputRequest($body) * Creates list of users with given input array * * @param \Swagger\Client\Model\User[] $body List of user object (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -486,6 +497,7 @@ public function createUsersWithListInput($body) * Creates list of users with given input array * * @param \Swagger\Client\Model\User[] $body List of user object (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -533,6 +545,7 @@ public function createUsersWithListInputWithHttpInfo($body) * Creates list of users with given input array * * @param \Swagger\Client\Model\User[] $body List of user object (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -549,6 +562,7 @@ public function createUsersWithListInputAsync($body) * Creates list of users with given input array * * @param \Swagger\Client\Model\User[] $body List of user object (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -575,6 +589,7 @@ public function createUsersWithListInputAsyncWithHttpInfo($body) * Create request for operation 'createUsersWithListInput' * * @param \Swagger\Client\Model\User[] $body List of user object (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -663,6 +678,7 @@ protected function createUsersWithListInputRequest($body) * Delete user * * @param string $username The name that needs to be deleted (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -678,6 +694,7 @@ public function deleteUser($username) * Delete user * * @param string $username The name that needs to be deleted (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -725,6 +742,7 @@ public function deleteUserWithHttpInfo($username) * Delete user * * @param string $username The name that needs to be deleted (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -741,6 +759,7 @@ public function deleteUserAsync($username) * Delete user * * @param string $username The name that needs to be deleted (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -767,6 +786,7 @@ public function deleteUserAsyncWithHttpInfo($username) * Create request for operation 'deleteUser' * * @param string $username The name that needs to be deleted (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -854,6 +874,7 @@ protected function deleteUserRequest($username) * Get user by user name * * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Swagger\Client\Model\User @@ -870,6 +891,7 @@ public function getUserByName($username) * Get user by user name * * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Swagger\Client\Model\User, HTTP status code, HTTP response headers (array of strings) @@ -935,6 +957,7 @@ public function getUserByNameWithHttpInfo($username) * Get user by user name * * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -951,6 +974,7 @@ public function getUserByNameAsync($username) * Get user by user name * * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -991,6 +1015,7 @@ public function getUserByNameAsyncWithHttpInfo($username) * Create request for operation 'getUserByName' * * @param string $username The name that needs to be fetched. Use user1 for testing. (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -1079,6 +1104,7 @@ protected function getUserByNameRequest($username) * * @param string $username The user name for login (required) * @param string $password The password for login in clear text (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return string @@ -1096,6 +1122,7 @@ public function loginUser($username, $password) * * @param string $username The user name for login (required) * @param string $password The password for login in clear text (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of string, HTTP status code, HTTP response headers (array of strings) @@ -1162,6 +1189,7 @@ public function loginUserWithHttpInfo($username, $password) * * @param string $username The user name for login (required) * @param string $password The password for login in clear text (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1179,6 +1207,7 @@ public function loginUserAsync($username, $password) * * @param string $username The user name for login (required) * @param string $password The password for login in clear text (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1220,6 +1249,7 @@ public function loginUserAsyncWithHttpInfo($username, $password) * * @param string $username The user name for login (required) * @param string $password The password for login in clear text (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -1314,6 +1344,7 @@ protected function loginUserRequest($username, $password) * * Logs out current logged in user session * + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -1328,6 +1359,7 @@ public function logoutUser() * * Logs out current logged in user session * + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -1374,6 +1406,7 @@ public function logoutUserWithHttpInfo() * * Logs out current logged in user session * + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1389,6 +1422,7 @@ public function logoutUserAsync() * * Logs out current logged in user session * + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1414,6 +1448,7 @@ public function logoutUserAsyncWithHttpInfo() /** * Create request for operation 'logoutUser' * + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ @@ -1494,6 +1529,7 @@ protected function logoutUserRequest() * * @param string $username name that need to be deleted (required) * @param \Swagger\Client\Model\User $body Updated user object (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void @@ -1510,6 +1546,7 @@ public function updateUser($username, $body) * * @param string $username name that need to be deleted (required) * @param \Swagger\Client\Model\User $body Updated user object (required) + * * @throws \Swagger\Client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) @@ -1558,6 +1595,7 @@ public function updateUserWithHttpInfo($username, $body) * * @param string $username name that need to be deleted (required) * @param \Swagger\Client\Model\User $body Updated user object (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1575,6 +1613,7 @@ public function updateUserAsync($username, $body) * * @param string $username name that need to be deleted (required) * @param \Swagger\Client\Model\User $body Updated user object (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ @@ -1602,6 +1641,7 @@ public function updateUserAsyncWithHttpInfo($username, $body) * * @param string $username name that need to be deleted (required) * @param \Swagger\Client\Model\User $body Updated user object (required) + * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ From a616c3919ff6aa952110e94890282d0e0a13a94c Mon Sep 17 00:00:00 2001 From: "akihito.nakano" Date: Sat, 16 Sep 2017 14:02:58 +0900 Subject: [PATCH 3/5] Improve line length --- .../src/main/resources/php/api.mustache | 105 +-- .../php/SwaggerClient-php/lib/Api/FakeApi.php | 55 +- .../lib/Api/AnotherFakeApi.php | 89 ++- .../php/SwaggerClient-php/lib/Api/FakeApi.php | 618 +++++++++++------- .../lib/Api/Fake_classname_tags123Api.php | 89 ++- .../php/SwaggerClient-php/lib/Api/PetApi.php | 616 ++++++++++------- .../SwaggerClient-php/lib/Api/StoreApi.php | 334 ++++++---- .../php/SwaggerClient-php/lib/Api/UserApi.php | 554 ++++++++++------ 8 files changed, 1490 insertions(+), 970 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index 94e31cdd07b..037330692f3 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -137,7 +137,11 @@ use {{invokerPackage}}\ObjectSerializer; if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -170,7 +174,11 @@ use {{invokerPackage}}\ObjectSerializer; {{#responses}} {{#dataType}} {{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}} - $data = ObjectSerializer::deserialize($e->getResponseBody(), '{{dataType}}', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '{{dataType}}', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; {{/dataType}} @@ -198,9 +206,10 @@ use {{invokerPackage}}\ObjectSerializer; */ public function {{operationId}}Async({{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}'{{{.}}}'{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { - return $this->{{operationId}}AsyncWithHttpInfo({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}})->then(function ($response) { - return $response[0]; - }); + return $this->{{operationId}}AsyncWithHttpInfo({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -224,37 +233,43 @@ use {{invokerPackage}}\ObjectSerializer; $returnType = '{{returnType}}'; $request = $this->{{operationId}}Request({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - {{#returnType}} - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + {{#returnType}} + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - {{/returnType}} - {{^returnType}} - return [null, $response->getStatusCode(), $response->getHeaders()]; - {{/returnType}} - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + {{/returnType}} + {{^returnType}} + return [null, $response->getStatusCode(), $response->getHeaders()]; + {{/returnType}} + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -273,7 +288,9 @@ use {{invokerPackage}}\ObjectSerializer; {{#required}} // verify the required parameter '{{paramName}}' is set if (${{paramName}} === null) { - throw new \InvalidArgumentException('Missing the required parameter ${{paramName}} when calling {{operationId}}'); + throw new \InvalidArgumentException( + 'Missing the required parameter ${{paramName}} when calling {{operationId}}' + ); } {{/required}} {{#hasValidation}} @@ -354,7 +371,11 @@ use {{invokerPackage}}\ObjectSerializer; } {{/collectionFormat}} if (${{paramName}} !== null) { - $resourcePath = str_replace('{' . '{{baseName}}' . '}', ObjectSerializer::toPathValue(${{paramName}}), $resourcePath); + $resourcePath = str_replace( + '{' . '{{baseName}}' . '}', + ObjectSerializer::toPathValue(${{paramName}}), + $resourcePath + ); } {{/pathParams}} @@ -402,13 +423,15 @@ use {{invokerPackage}}\ObjectSerializer; 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -434,9 +457,6 @@ use {{invokerPackage}}\ObjectSerializer; {{/isOAuth}} {{/authMethods}} - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -448,9 +468,10 @@ use {{invokerPackage}}\ObjectSerializer; $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( '{{httpMethod}}', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php index cc80c3adfe2..98df6cbe19a 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -129,7 +129,11 @@ public function testCodeInjectEndRnNRWithHttpInfo($test_code_inject____end____rn if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -157,9 +161,10 @@ public function testCodeInjectEndRnNRWithHttpInfo($test_code_inject____end____rn */ public function testCodeInjectEndRnNRAsync($test_code_inject____end____rn_n_r = null) { - return $this->testCodeInjectEndRnNRAsyncWithHttpInfo($test_code_inject____end____rn_n_r)->then(function ($response) { - return $response[0]; - }); + return $this->testCodeInjectEndRnNRAsyncWithHttpInfo($test_code_inject____end____rn_n_r) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -177,18 +182,24 @@ public function testCodeInjectEndRnNRAsyncWithHttpInfo($test_code_inject____end_ $returnType = ''; $request = $this->testCodeInjectEndRnNRRequest($test_code_inject____end____rn_n_r); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -240,20 +251,19 @@ protected function testCodeInjectEndRnNRRequest($test_code_inject____end____rn_n 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -265,9 +275,10 @@ protected function testCodeInjectEndRnNRRequest($test_code_inject____end____rn_n $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'PUT', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/AnotherFakeApi.php index 3f42243f107..39719739c53 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/AnotherFakeApi.php @@ -130,7 +130,11 @@ public function testSpecialTagsWithHttpInfo($body) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -156,7 +160,11 @@ public function testSpecialTagsWithHttpInfo($body) } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Client', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Client', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } @@ -176,9 +184,10 @@ public function testSpecialTagsWithHttpInfo($body) */ public function testSpecialTagsAsync($body) { - return $this->testSpecialTagsAsyncWithHttpInfo($body)->then(function ($response) { - return $response[0]; - }); + return $this->testSpecialTagsAsyncWithHttpInfo($body) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -196,32 +205,38 @@ public function testSpecialTagsAsyncWithHttpInfo($body) $returnType = '\Swagger\Client\Model\Client'; $request = $this->testSpecialTagsRequest($body); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -236,7 +251,9 @@ protected function testSpecialTagsRequest($body) { // verify the required parameter 'body' is set if ($body === null) { - throw new \InvalidArgumentException('Missing the required parameter $body when calling testSpecialTags'); + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling testSpecialTags' + ); } $resourcePath = '/another-fake/dummy'; @@ -278,20 +295,19 @@ protected function testSpecialTagsRequest($body) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -303,9 +319,10 @@ protected function testSpecialTagsRequest($body) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'PATCH', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index 9b2a9c1a9d2..303ed18f92b 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -126,7 +126,11 @@ public function fakeOuterBooleanSerializeWithHttpInfo($body = null) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -152,7 +156,11 @@ public function fakeOuterBooleanSerializeWithHttpInfo($body = null) } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\OuterBoolean', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\OuterBoolean', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } @@ -172,9 +180,10 @@ public function fakeOuterBooleanSerializeWithHttpInfo($body = null) */ public function fakeOuterBooleanSerializeAsync($body = null) { - return $this->fakeOuterBooleanSerializeAsyncWithHttpInfo($body)->then(function ($response) { - return $response[0]; - }); + return $this->fakeOuterBooleanSerializeAsyncWithHttpInfo($body) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -192,32 +201,38 @@ public function fakeOuterBooleanSerializeAsyncWithHttpInfo($body = null) $returnType = '\Swagger\Client\Model\OuterBoolean'; $request = $this->fakeOuterBooleanSerializeRequest($body); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -270,20 +285,19 @@ protected function fakeOuterBooleanSerializeRequest($body = null) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -295,9 +309,10 @@ protected function fakeOuterBooleanSerializeRequest($body = null) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -348,7 +363,11 @@ public function fakeOuterCompositeSerializeWithHttpInfo($body = null) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -374,7 +393,11 @@ public function fakeOuterCompositeSerializeWithHttpInfo($body = null) } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\OuterComposite', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\OuterComposite', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } @@ -394,9 +417,10 @@ public function fakeOuterCompositeSerializeWithHttpInfo($body = null) */ public function fakeOuterCompositeSerializeAsync($body = null) { - return $this->fakeOuterCompositeSerializeAsyncWithHttpInfo($body)->then(function ($response) { - return $response[0]; - }); + return $this->fakeOuterCompositeSerializeAsyncWithHttpInfo($body) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -414,32 +438,38 @@ public function fakeOuterCompositeSerializeAsyncWithHttpInfo($body = null) $returnType = '\Swagger\Client\Model\OuterComposite'; $request = $this->fakeOuterCompositeSerializeRequest($body); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -492,20 +522,19 @@ protected function fakeOuterCompositeSerializeRequest($body = null) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -517,9 +546,10 @@ protected function fakeOuterCompositeSerializeRequest($body = null) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -570,7 +600,11 @@ public function fakeOuterNumberSerializeWithHttpInfo($body = null) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -596,7 +630,11 @@ public function fakeOuterNumberSerializeWithHttpInfo($body = null) } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\OuterNumber', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\OuterNumber', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } @@ -616,9 +654,10 @@ public function fakeOuterNumberSerializeWithHttpInfo($body = null) */ public function fakeOuterNumberSerializeAsync($body = null) { - return $this->fakeOuterNumberSerializeAsyncWithHttpInfo($body)->then(function ($response) { - return $response[0]; - }); + return $this->fakeOuterNumberSerializeAsyncWithHttpInfo($body) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -636,32 +675,38 @@ public function fakeOuterNumberSerializeAsyncWithHttpInfo($body = null) $returnType = '\Swagger\Client\Model\OuterNumber'; $request = $this->fakeOuterNumberSerializeRequest($body); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -714,20 +759,19 @@ protected function fakeOuterNumberSerializeRequest($body = null) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -739,9 +783,10 @@ protected function fakeOuterNumberSerializeRequest($body = null) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -792,7 +837,11 @@ public function fakeOuterStringSerializeWithHttpInfo($body = null) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -818,7 +867,11 @@ public function fakeOuterStringSerializeWithHttpInfo($body = null) } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\OuterString', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\OuterString', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } @@ -838,9 +891,10 @@ public function fakeOuterStringSerializeWithHttpInfo($body = null) */ public function fakeOuterStringSerializeAsync($body = null) { - return $this->fakeOuterStringSerializeAsyncWithHttpInfo($body)->then(function ($response) { - return $response[0]; - }); + return $this->fakeOuterStringSerializeAsyncWithHttpInfo($body) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -858,32 +912,38 @@ public function fakeOuterStringSerializeAsyncWithHttpInfo($body = null) $returnType = '\Swagger\Client\Model\OuterString'; $request = $this->fakeOuterStringSerializeRequest($body); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -936,20 +996,19 @@ protected function fakeOuterStringSerializeRequest($body = null) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -961,9 +1020,10 @@ protected function fakeOuterStringSerializeRequest($body = null) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1018,7 +1078,11 @@ public function testClientModelWithHttpInfo($body) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -1044,7 +1108,11 @@ public function testClientModelWithHttpInfo($body) } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Client', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Client', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } @@ -1064,9 +1132,10 @@ public function testClientModelWithHttpInfo($body) */ public function testClientModelAsync($body) { - return $this->testClientModelAsyncWithHttpInfo($body)->then(function ($response) { - return $response[0]; - }); + return $this->testClientModelAsyncWithHttpInfo($body) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -1084,32 +1153,38 @@ public function testClientModelAsyncWithHttpInfo($body) $returnType = '\Swagger\Client\Model\Client'; $request = $this->testClientModelRequest($body); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -1124,7 +1199,9 @@ protected function testClientModelRequest($body) { // verify the required parameter 'body' is set if ($body === null) { - throw new \InvalidArgumentException('Missing the required parameter $body when calling testClientModel'); + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling testClientModel' + ); } $resourcePath = '/fake'; @@ -1166,20 +1243,19 @@ protected function testClientModelRequest($body) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -1191,9 +1267,10 @@ protected function testClientModelRequest($body) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'PATCH', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1273,7 +1350,11 @@ public function testEndpointParametersWithHttpInfo($number, $double, $pattern_wi if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -1314,9 +1395,10 @@ public function testEndpointParametersWithHttpInfo($number, $double, $pattern_wi */ public function testEndpointParametersAsync($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) { - return $this->testEndpointParametersAsyncWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback)->then(function ($response) { - return $response[0]; - }); + return $this->testEndpointParametersAsyncWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -1347,18 +1429,24 @@ public function testEndpointParametersAsyncWithHttpInfo($number, $double, $patte $returnType = ''; $request = $this->testEndpointParametersRequest($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -1386,7 +1474,9 @@ protected function testEndpointParametersRequest($number, $double, $pattern_with { // verify the required parameter 'number' is set if ($number === null) { - throw new \InvalidArgumentException('Missing the required parameter $number when calling testEndpointParameters'); + throw new \InvalidArgumentException( + 'Missing the required parameter $number when calling testEndpointParameters' + ); } if ($number > 543.2) { throw new \InvalidArgumentException('invalid value for "$number" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 543.2.'); @@ -1397,7 +1487,9 @@ protected function testEndpointParametersRequest($number, $double, $pattern_with // verify the required parameter 'double' is set if ($double === null) { - throw new \InvalidArgumentException('Missing the required parameter $double when calling testEndpointParameters'); + throw new \InvalidArgumentException( + 'Missing the required parameter $double when calling testEndpointParameters' + ); } if ($double > 123.4) { throw new \InvalidArgumentException('invalid value for "$double" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 123.4.'); @@ -1408,7 +1500,9 @@ protected function testEndpointParametersRequest($number, $double, $pattern_with // verify the required parameter 'pattern_without_delimiter' is set if ($pattern_without_delimiter === null) { - throw new \InvalidArgumentException('Missing the required parameter $pattern_without_delimiter when calling testEndpointParameters'); + throw new \InvalidArgumentException( + 'Missing the required parameter $pattern_without_delimiter when calling testEndpointParameters' + ); } if (!preg_match("/^[A-Z].*_/", $pattern_without_delimiter)) { throw new \InvalidArgumentException("invalid value for \"pattern_without_delimiter\" when calling FakeApi.testEndpointParameters, must conform to the pattern /^[A-Z].*_/."); @@ -1416,7 +1510,9 @@ protected function testEndpointParametersRequest($number, $double, $pattern_with // verify the required parameter 'byte' is set if ($byte === null) { - throw new \InvalidArgumentException('Missing the required parameter $byte when calling testEndpointParameters'); + throw new \InvalidArgumentException( + 'Missing the required parameter $byte when calling testEndpointParameters' + ); } if ($integer !== null && $integer > 100) { throw new \InvalidArgumentException('invalid value for "$integer" when calling FakeApi.testEndpointParameters, must be smaller than or equal to 100.'); @@ -1538,13 +1634,15 @@ protected function testEndpointParametersRequest($number, $double, $pattern_with 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1553,9 +1651,6 @@ protected function testEndpointParametersRequest($number, $double, $pattern_with $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -1567,9 +1662,10 @@ protected function testEndpointParametersRequest($number, $double, $pattern_with $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1637,7 +1733,11 @@ public function testEnumParametersWithHttpInfo($enum_form_string_array = null, $ if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -1672,9 +1772,10 @@ public function testEnumParametersWithHttpInfo($enum_form_string_array = null, $ */ public function testEnumParametersAsync($enum_form_string_array = null, $enum_form_string = '-efg', $enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null) { - return $this->testEnumParametersAsyncWithHttpInfo($enum_form_string_array, $enum_form_string, $enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double)->then(function ($response) { - return $response[0]; - }); + return $this->testEnumParametersAsyncWithHttpInfo($enum_form_string_array, $enum_form_string, $enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -1699,18 +1800,24 @@ public function testEnumParametersAsyncWithHttpInfo($enum_form_string_array = nu $returnType = ''; $request = $this->testEnumParametersRequest($enum_form_string_array, $enum_form_string, $enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -1803,20 +1910,19 @@ protected function testEnumParametersRequest($enum_form_string_array = null, $en 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -1828,9 +1934,10 @@ protected function testEnumParametersRequest($enum_form_string_array = null, $en $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1886,7 +1993,11 @@ public function testJsonFormDataWithHttpInfo($param, $param2) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -1915,9 +2026,10 @@ public function testJsonFormDataWithHttpInfo($param, $param2) */ public function testJsonFormDataAsync($param, $param2) { - return $this->testJsonFormDataAsyncWithHttpInfo($param, $param2)->then(function ($response) { - return $response[0]; - }); + return $this->testJsonFormDataAsyncWithHttpInfo($param, $param2) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -1936,18 +2048,24 @@ public function testJsonFormDataAsyncWithHttpInfo($param, $param2) $returnType = ''; $request = $this->testJsonFormDataRequest($param, $param2); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -1963,11 +2081,15 @@ protected function testJsonFormDataRequest($param, $param2) { // verify the required parameter 'param' is set if ($param === null) { - throw new \InvalidArgumentException('Missing the required parameter $param when calling testJsonFormData'); + throw new \InvalidArgumentException( + 'Missing the required parameter $param when calling testJsonFormData' + ); } // verify the required parameter 'param2' is set if ($param2 === null) { - throw new \InvalidArgumentException('Missing the required parameter $param2 when calling testJsonFormData'); + throw new \InvalidArgumentException( + 'Missing the required parameter $param2 when calling testJsonFormData' + ); } $resourcePath = '/fake/jsonFormData'; @@ -2012,20 +2134,19 @@ protected function testJsonFormDataRequest($param, $param2) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -2037,9 +2158,10 @@ protected function testJsonFormDataRequest($param, $param2) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/Fake_classname_tags123Api.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/Fake_classname_tags123Api.php index a8dd23d9b82..b7df0bd3d62 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/Fake_classname_tags123Api.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/Fake_classname_tags123Api.php @@ -130,7 +130,11 @@ public function testClassnameWithHttpInfo($body) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -156,7 +160,11 @@ public function testClassnameWithHttpInfo($body) } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Client', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Client', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } @@ -176,9 +184,10 @@ public function testClassnameWithHttpInfo($body) */ public function testClassnameAsync($body) { - return $this->testClassnameAsyncWithHttpInfo($body)->then(function ($response) { - return $response[0]; - }); + return $this->testClassnameAsyncWithHttpInfo($body) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -196,32 +205,38 @@ public function testClassnameAsyncWithHttpInfo($body) $returnType = '\Swagger\Client\Model\Client'; $request = $this->testClassnameRequest($body); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -236,7 +251,9 @@ protected function testClassnameRequest($body) { // verify the required parameter 'body' is set if ($body === null) { - throw new \InvalidArgumentException('Missing the required parameter $body when calling testClassname'); + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling testClassname' + ); } $resourcePath = '/fake_classname_test'; @@ -278,13 +295,15 @@ protected function testClassnameRequest($body) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -294,9 +313,6 @@ protected function testClassnameRequest($body) $queryParams['api_key_query'] = $apiKey; } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -308,9 +324,10 @@ protected function testClassnameRequest($body) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'PATCH', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php index 47b4ae269bc..511ebbf91d3 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -129,7 +129,11 @@ public function addPetWithHttpInfo($body) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -157,9 +161,10 @@ public function addPetWithHttpInfo($body) */ public function addPetAsync($body) { - return $this->addPetAsyncWithHttpInfo($body)->then(function ($response) { - return $response[0]; - }); + return $this->addPetAsyncWithHttpInfo($body) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -177,18 +182,24 @@ public function addPetAsyncWithHttpInfo($body) $returnType = ''; $request = $this->addPetRequest($body); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -203,7 +214,9 @@ protected function addPetRequest($body) { // verify the required parameter 'body' is set if ($body === null) { - throw new \InvalidArgumentException('Missing the required parameter $body when calling addPet'); + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling addPet' + ); } $resourcePath = '/pet'; @@ -245,13 +258,15 @@ protected function addPetRequest($body) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -260,9 +275,6 @@ protected function addPetRequest($body) $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -274,9 +286,10 @@ protected function addPetRequest($body) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -332,7 +345,11 @@ public function deletePetWithHttpInfo($pet_id, $api_key = null) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -361,9 +378,10 @@ public function deletePetWithHttpInfo($pet_id, $api_key = null) */ public function deletePetAsync($pet_id, $api_key = null) { - return $this->deletePetAsyncWithHttpInfo($pet_id, $api_key)->then(function ($response) { - return $response[0]; - }); + return $this->deletePetAsyncWithHttpInfo($pet_id, $api_key) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -382,18 +400,24 @@ public function deletePetAsyncWithHttpInfo($pet_id, $api_key = null) $returnType = ''; $request = $this->deletePetRequest($pet_id, $api_key); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -409,7 +433,9 @@ protected function deletePetRequest($pet_id, $api_key = null) { // verify the required parameter 'pet_id' is set if ($pet_id === null) { - throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling deletePet'); + throw new \InvalidArgumentException( + 'Missing the required parameter $pet_id when calling deletePet' + ); } $resourcePath = '/pet/{petId}'; @@ -426,7 +452,11 @@ protected function deletePetRequest($pet_id, $api_key = null) // path params if ($pet_id !== null) { - $resourcePath = str_replace('{' . 'petId' . '}', ObjectSerializer::toPathValue($pet_id), $resourcePath); + $resourcePath = str_replace( + '{' . 'petId' . '}', + ObjectSerializer::toPathValue($pet_id), + $resourcePath + ); } @@ -454,13 +484,15 @@ protected function deletePetRequest($pet_id, $api_key = null) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -469,9 +501,6 @@ protected function deletePetRequest($pet_id, $api_key = null) $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -483,9 +512,10 @@ protected function deletePetRequest($pet_id, $api_key = null) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'DELETE', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -540,7 +570,11 @@ public function findPetsByStatusWithHttpInfo($status) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -566,7 +600,11 @@ public function findPetsByStatusWithHttpInfo($status) } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet[]', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Pet[]', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } @@ -586,9 +624,10 @@ public function findPetsByStatusWithHttpInfo($status) */ public function findPetsByStatusAsync($status) { - return $this->findPetsByStatusAsyncWithHttpInfo($status)->then(function ($response) { - return $response[0]; - }); + return $this->findPetsByStatusAsyncWithHttpInfo($status) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -606,32 +645,38 @@ public function findPetsByStatusAsyncWithHttpInfo($status) $returnType = '\Swagger\Client\Model\Pet[]'; $request = $this->findPetsByStatusRequest($status); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -646,7 +691,9 @@ protected function findPetsByStatusRequest($status) { // verify the required parameter 'status' is set if ($status === null) { - throw new \InvalidArgumentException('Missing the required parameter $status when calling findPetsByStatus'); + throw new \InvalidArgumentException( + 'Missing the required parameter $status when calling findPetsByStatus' + ); } $resourcePath = '/pet/findByStatus'; @@ -690,13 +737,15 @@ protected function findPetsByStatusRequest($status) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -705,9 +754,6 @@ protected function findPetsByStatusRequest($status) $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -719,9 +765,10 @@ protected function findPetsByStatusRequest($status) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -776,7 +823,11 @@ public function findPetsByTagsWithHttpInfo($tags) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -802,7 +853,11 @@ public function findPetsByTagsWithHttpInfo($tags) } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet[]', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Pet[]', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } @@ -822,9 +877,10 @@ public function findPetsByTagsWithHttpInfo($tags) */ public function findPetsByTagsAsync($tags) { - return $this->findPetsByTagsAsyncWithHttpInfo($tags)->then(function ($response) { - return $response[0]; - }); + return $this->findPetsByTagsAsyncWithHttpInfo($tags) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -842,32 +898,38 @@ public function findPetsByTagsAsyncWithHttpInfo($tags) $returnType = '\Swagger\Client\Model\Pet[]'; $request = $this->findPetsByTagsRequest($tags); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -882,7 +944,9 @@ protected function findPetsByTagsRequest($tags) { // verify the required parameter 'tags' is set if ($tags === null) { - throw new \InvalidArgumentException('Missing the required parameter $tags when calling findPetsByTags'); + throw new \InvalidArgumentException( + 'Missing the required parameter $tags when calling findPetsByTags' + ); } $resourcePath = '/pet/findByTags'; @@ -926,13 +990,15 @@ protected function findPetsByTagsRequest($tags) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -941,9 +1007,6 @@ protected function findPetsByTagsRequest($tags) $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -955,9 +1018,10 @@ protected function findPetsByTagsRequest($tags) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1012,7 +1076,11 @@ public function getPetByIdWithHttpInfo($pet_id) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -1038,7 +1106,11 @@ public function getPetByIdWithHttpInfo($pet_id) } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Pet', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } @@ -1058,9 +1130,10 @@ public function getPetByIdWithHttpInfo($pet_id) */ public function getPetByIdAsync($pet_id) { - return $this->getPetByIdAsyncWithHttpInfo($pet_id)->then(function ($response) { - return $response[0]; - }); + return $this->getPetByIdAsyncWithHttpInfo($pet_id) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -1078,32 +1151,38 @@ public function getPetByIdAsyncWithHttpInfo($pet_id) $returnType = '\Swagger\Client\Model\Pet'; $request = $this->getPetByIdRequest($pet_id); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -1118,7 +1197,9 @@ protected function getPetByIdRequest($pet_id) { // verify the required parameter 'pet_id' is set if ($pet_id === null) { - throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling getPetById'); + throw new \InvalidArgumentException( + 'Missing the required parameter $pet_id when calling getPetById' + ); } $resourcePath = '/pet/{petId}'; @@ -1131,7 +1212,11 @@ protected function getPetByIdRequest($pet_id) // path params if ($pet_id !== null) { - $resourcePath = str_replace('{' . 'petId' . '}', ObjectSerializer::toPathValue($pet_id), $resourcePath); + $resourcePath = str_replace( + '{' . 'petId' . '}', + ObjectSerializer::toPathValue($pet_id), + $resourcePath + ); } @@ -1159,13 +1244,15 @@ protected function getPetByIdRequest($pet_id) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1175,9 +1262,6 @@ protected function getPetByIdRequest($pet_id) $headers['api_key'] = $apiKey; } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -1189,9 +1273,10 @@ protected function getPetByIdRequest($pet_id) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1245,7 +1330,11 @@ public function updatePetWithHttpInfo($body) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -1273,9 +1362,10 @@ public function updatePetWithHttpInfo($body) */ public function updatePetAsync($body) { - return $this->updatePetAsyncWithHttpInfo($body)->then(function ($response) { - return $response[0]; - }); + return $this->updatePetAsyncWithHttpInfo($body) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -1293,18 +1383,24 @@ public function updatePetAsyncWithHttpInfo($body) $returnType = ''; $request = $this->updatePetRequest($body); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -1319,7 +1415,9 @@ protected function updatePetRequest($body) { // verify the required parameter 'body' is set if ($body === null) { - throw new \InvalidArgumentException('Missing the required parameter $body when calling updatePet'); + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling updatePet' + ); } $resourcePath = '/pet'; @@ -1361,13 +1459,15 @@ protected function updatePetRequest($body) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1376,9 +1476,6 @@ protected function updatePetRequest($body) $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -1390,9 +1487,10 @@ protected function updatePetRequest($body) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'PUT', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1450,7 +1548,11 @@ public function updatePetWithFormWithHttpInfo($pet_id, $name = null, $status = n if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -1480,9 +1582,10 @@ public function updatePetWithFormWithHttpInfo($pet_id, $name = null, $status = n */ public function updatePetWithFormAsync($pet_id, $name = null, $status = null) { - return $this->updatePetWithFormAsyncWithHttpInfo($pet_id, $name, $status)->then(function ($response) { - return $response[0]; - }); + return $this->updatePetWithFormAsyncWithHttpInfo($pet_id, $name, $status) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -1502,18 +1605,24 @@ public function updatePetWithFormAsyncWithHttpInfo($pet_id, $name = null, $statu $returnType = ''; $request = $this->updatePetWithFormRequest($pet_id, $name, $status); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -1530,7 +1639,9 @@ protected function updatePetWithFormRequest($pet_id, $name = null, $status = nul { // verify the required parameter 'pet_id' is set if ($pet_id === null) { - throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling updatePetWithForm'); + throw new \InvalidArgumentException( + 'Missing the required parameter $pet_id when calling updatePetWithForm' + ); } $resourcePath = '/pet/{petId}'; @@ -1543,7 +1654,11 @@ protected function updatePetWithFormRequest($pet_id, $name = null, $status = nul // path params if ($pet_id !== null) { - $resourcePath = str_replace('{' . 'petId' . '}', ObjectSerializer::toPathValue($pet_id), $resourcePath); + $resourcePath = str_replace( + '{' . 'petId' . '}', + ObjectSerializer::toPathValue($pet_id), + $resourcePath + ); } // form params @@ -1579,13 +1694,15 @@ protected function updatePetWithFormRequest($pet_id, $name = null, $status = nul 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1594,9 +1711,6 @@ protected function updatePetWithFormRequest($pet_id, $name = null, $status = nul $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -1608,9 +1722,10 @@ protected function updatePetWithFormRequest($pet_id, $name = null, $status = nul $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1669,7 +1784,11 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -1695,7 +1814,11 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\ApiResponse', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\ApiResponse', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } @@ -1717,9 +1840,10 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi */ public function uploadFileAsync($pet_id, $additional_metadata = null, $file = null) { - return $this->uploadFileAsyncWithHttpInfo($pet_id, $additional_metadata, $file)->then(function ($response) { - return $response[0]; - }); + return $this->uploadFileAsyncWithHttpInfo($pet_id, $additional_metadata, $file) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -1739,32 +1863,38 @@ public function uploadFileAsyncWithHttpInfo($pet_id, $additional_metadata = null $returnType = '\Swagger\Client\Model\ApiResponse'; $request = $this->uploadFileRequest($pet_id, $additional_metadata, $file); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -1781,7 +1911,9 @@ protected function uploadFileRequest($pet_id, $additional_metadata = null, $file { // verify the required parameter 'pet_id' is set if ($pet_id === null) { - throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling uploadFile'); + throw new \InvalidArgumentException( + 'Missing the required parameter $pet_id when calling uploadFile' + ); } $resourcePath = '/pet/{petId}/uploadImage'; @@ -1794,7 +1926,11 @@ protected function uploadFileRequest($pet_id, $additional_metadata = null, $file // path params if ($pet_id !== null) { - $resourcePath = str_replace('{' . 'petId' . '}', ObjectSerializer::toPathValue($pet_id), $resourcePath); + $resourcePath = str_replace( + '{' . 'petId' . '}', + ObjectSerializer::toPathValue($pet_id), + $resourcePath + ); } // form params @@ -1831,13 +1967,15 @@ protected function uploadFileRequest($pet_id, $additional_metadata = null, $file 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -1846,9 +1984,6 @@ protected function uploadFileRequest($pet_id, $additional_metadata = null, $file $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -1860,9 +1995,10 @@ protected function uploadFileRequest($pet_id, $additional_metadata = null, $file $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php index 64a19ed7a4a..641ca401df1 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -129,7 +129,11 @@ public function deleteOrderWithHttpInfo($order_id) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -157,9 +161,10 @@ public function deleteOrderWithHttpInfo($order_id) */ public function deleteOrderAsync($order_id) { - return $this->deleteOrderAsyncWithHttpInfo($order_id)->then(function ($response) { - return $response[0]; - }); + return $this->deleteOrderAsyncWithHttpInfo($order_id) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -177,18 +182,24 @@ public function deleteOrderAsyncWithHttpInfo($order_id) $returnType = ''; $request = $this->deleteOrderRequest($order_id); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -203,7 +214,9 @@ protected function deleteOrderRequest($order_id) { // verify the required parameter 'order_id' is set if ($order_id === null) { - throw new \InvalidArgumentException('Missing the required parameter $order_id when calling deleteOrder'); + throw new \InvalidArgumentException( + 'Missing the required parameter $order_id when calling deleteOrder' + ); } $resourcePath = '/store/order/{order_id}'; @@ -216,7 +229,11 @@ protected function deleteOrderRequest($order_id) // path params if ($order_id !== null) { - $resourcePath = str_replace('{' . 'order_id' . '}', ObjectSerializer::toPathValue($order_id), $resourcePath); + $resourcePath = str_replace( + '{' . 'order_id' . '}', + ObjectSerializer::toPathValue($order_id), + $resourcePath + ); } @@ -244,20 +261,19 @@ protected function deleteOrderRequest($order_id) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -269,9 +285,10 @@ protected function deleteOrderRequest($order_id) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'DELETE', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -324,7 +341,11 @@ public function getInventoryWithHttpInfo() if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -350,7 +371,11 @@ public function getInventoryWithHttpInfo() } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = ObjectSerializer::deserialize($e->getResponseBody(), 'map[string,int]', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'map[string,int]', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } @@ -369,9 +394,10 @@ public function getInventoryWithHttpInfo() */ public function getInventoryAsync() { - return $this->getInventoryAsyncWithHttpInfo()->then(function ($response) { - return $response[0]; - }); + return $this->getInventoryAsyncWithHttpInfo() + ->then(function ($response) { + return $response[0]; + }); } /** @@ -388,32 +414,38 @@ public function getInventoryAsyncWithHttpInfo() $returnType = 'map[string,int]'; $request = $this->getInventoryRequest(); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -460,13 +492,15 @@ protected function getInventoryRequest() 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } @@ -476,9 +510,6 @@ protected function getInventoryRequest() $headers['api_key'] = $apiKey; } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -490,9 +521,10 @@ protected function getInventoryRequest() $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -547,7 +579,11 @@ public function getOrderByIdWithHttpInfo($order_id) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -573,7 +609,11 @@ public function getOrderByIdWithHttpInfo($order_id) } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Order', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } @@ -593,9 +633,10 @@ public function getOrderByIdWithHttpInfo($order_id) */ public function getOrderByIdAsync($order_id) { - return $this->getOrderByIdAsyncWithHttpInfo($order_id)->then(function ($response) { - return $response[0]; - }); + return $this->getOrderByIdAsyncWithHttpInfo($order_id) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -613,32 +654,38 @@ public function getOrderByIdAsyncWithHttpInfo($order_id) $returnType = '\Swagger\Client\Model\Order'; $request = $this->getOrderByIdRequest($order_id); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -653,7 +700,9 @@ protected function getOrderByIdRequest($order_id) { // verify the required parameter 'order_id' is set if ($order_id === null) { - throw new \InvalidArgumentException('Missing the required parameter $order_id when calling getOrderById'); + throw new \InvalidArgumentException( + 'Missing the required parameter $order_id when calling getOrderById' + ); } if ($order_id > 5) { throw new \InvalidArgumentException('invalid value for "$order_id" when calling StoreApi.getOrderById, must be smaller than or equal to 5.'); @@ -673,7 +722,11 @@ protected function getOrderByIdRequest($order_id) // path params if ($order_id !== null) { - $resourcePath = str_replace('{' . 'order_id' . '}', ObjectSerializer::toPathValue($order_id), $resourcePath); + $resourcePath = str_replace( + '{' . 'order_id' . '}', + ObjectSerializer::toPathValue($order_id), + $resourcePath + ); } @@ -701,20 +754,19 @@ protected function getOrderByIdRequest($order_id) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -726,9 +778,10 @@ protected function getOrderByIdRequest($order_id) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -783,7 +836,11 @@ public function placeOrderWithHttpInfo($body) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -809,7 +866,11 @@ public function placeOrderWithHttpInfo($body) } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\Order', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } @@ -829,9 +890,10 @@ public function placeOrderWithHttpInfo($body) */ public function placeOrderAsync($body) { - return $this->placeOrderAsyncWithHttpInfo($body)->then(function ($response) { - return $response[0]; - }); + return $this->placeOrderAsyncWithHttpInfo($body) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -849,32 +911,38 @@ public function placeOrderAsyncWithHttpInfo($body) $returnType = '\Swagger\Client\Model\Order'; $request = $this->placeOrderRequest($body); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -889,7 +957,9 @@ protected function placeOrderRequest($body) { // verify the required parameter 'body' is set if ($body === null) { - throw new \InvalidArgumentException('Missing the required parameter $body when calling placeOrder'); + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling placeOrder' + ); } $resourcePath = '/store/order'; @@ -931,20 +1001,19 @@ protected function placeOrderRequest($body) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -956,9 +1025,10 @@ protected function placeOrderRequest($body) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php index 99f30baebfd..24e40404a08 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -129,7 +129,11 @@ public function createUserWithHttpInfo($body) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -157,9 +161,10 @@ public function createUserWithHttpInfo($body) */ public function createUserAsync($body) { - return $this->createUserAsyncWithHttpInfo($body)->then(function ($response) { - return $response[0]; - }); + return $this->createUserAsyncWithHttpInfo($body) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -177,18 +182,24 @@ public function createUserAsyncWithHttpInfo($body) $returnType = ''; $request = $this->createUserRequest($body); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -203,7 +214,9 @@ protected function createUserRequest($body) { // verify the required parameter 'body' is set if ($body === null) { - throw new \InvalidArgumentException('Missing the required parameter $body when calling createUser'); + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling createUser' + ); } $resourcePath = '/user'; @@ -245,20 +258,19 @@ protected function createUserRequest($body) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -270,9 +282,10 @@ protected function createUserRequest($body) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -326,7 +339,11 @@ public function createUsersWithArrayInputWithHttpInfo($body) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -354,9 +371,10 @@ public function createUsersWithArrayInputWithHttpInfo($body) */ public function createUsersWithArrayInputAsync($body) { - return $this->createUsersWithArrayInputAsyncWithHttpInfo($body)->then(function ($response) { - return $response[0]; - }); + return $this->createUsersWithArrayInputAsyncWithHttpInfo($body) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -374,18 +392,24 @@ public function createUsersWithArrayInputAsyncWithHttpInfo($body) $returnType = ''; $request = $this->createUsersWithArrayInputRequest($body); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -400,7 +424,9 @@ protected function createUsersWithArrayInputRequest($body) { // verify the required parameter 'body' is set if ($body === null) { - throw new \InvalidArgumentException('Missing the required parameter $body when calling createUsersWithArrayInput'); + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling createUsersWithArrayInput' + ); } $resourcePath = '/user/createWithArray'; @@ -442,20 +468,19 @@ protected function createUsersWithArrayInputRequest($body) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -467,9 +492,10 @@ protected function createUsersWithArrayInputRequest($body) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -523,7 +549,11 @@ public function createUsersWithListInputWithHttpInfo($body) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -551,9 +581,10 @@ public function createUsersWithListInputWithHttpInfo($body) */ public function createUsersWithListInputAsync($body) { - return $this->createUsersWithListInputAsyncWithHttpInfo($body)->then(function ($response) { - return $response[0]; - }); + return $this->createUsersWithListInputAsyncWithHttpInfo($body) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -571,18 +602,24 @@ public function createUsersWithListInputAsyncWithHttpInfo($body) $returnType = ''; $request = $this->createUsersWithListInputRequest($body); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -597,7 +634,9 @@ protected function createUsersWithListInputRequest($body) { // verify the required parameter 'body' is set if ($body === null) { - throw new \InvalidArgumentException('Missing the required parameter $body when calling createUsersWithListInput'); + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling createUsersWithListInput' + ); } $resourcePath = '/user/createWithList'; @@ -639,20 +678,19 @@ protected function createUsersWithListInputRequest($body) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -664,9 +702,10 @@ protected function createUsersWithListInputRequest($body) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'POST', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -720,7 +759,11 @@ public function deleteUserWithHttpInfo($username) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -748,9 +791,10 @@ public function deleteUserWithHttpInfo($username) */ public function deleteUserAsync($username) { - return $this->deleteUserAsyncWithHttpInfo($username)->then(function ($response) { - return $response[0]; - }); + return $this->deleteUserAsyncWithHttpInfo($username) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -768,18 +812,24 @@ public function deleteUserAsyncWithHttpInfo($username) $returnType = ''; $request = $this->deleteUserRequest($username); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -794,7 +844,9 @@ protected function deleteUserRequest($username) { // verify the required parameter 'username' is set if ($username === null) { - throw new \InvalidArgumentException('Missing the required parameter $username when calling deleteUser'); + throw new \InvalidArgumentException( + 'Missing the required parameter $username when calling deleteUser' + ); } $resourcePath = '/user/{username}'; @@ -807,7 +859,11 @@ protected function deleteUserRequest($username) // path params if ($username !== null) { - $resourcePath = str_replace('{' . 'username' . '}', ObjectSerializer::toPathValue($username), $resourcePath); + $resourcePath = str_replace( + '{' . 'username' . '}', + ObjectSerializer::toPathValue($username), + $resourcePath + ); } @@ -835,20 +891,19 @@ protected function deleteUserRequest($username) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -860,9 +915,10 @@ protected function deleteUserRequest($username) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'DELETE', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -917,7 +973,11 @@ public function getUserByNameWithHttpInfo($username) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -943,7 +1003,11 @@ public function getUserByNameWithHttpInfo($username) } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\User', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Swagger\Client\Model\User', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } @@ -963,9 +1027,10 @@ public function getUserByNameWithHttpInfo($username) */ public function getUserByNameAsync($username) { - return $this->getUserByNameAsyncWithHttpInfo($username)->then(function ($response) { - return $response[0]; - }); + return $this->getUserByNameAsyncWithHttpInfo($username) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -983,32 +1048,38 @@ public function getUserByNameAsyncWithHttpInfo($username) $returnType = '\Swagger\Client\Model\User'; $request = $this->getUserByNameRequest($username); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -1023,7 +1094,9 @@ protected function getUserByNameRequest($username) { // verify the required parameter 'username' is set if ($username === null) { - throw new \InvalidArgumentException('Missing the required parameter $username when calling getUserByName'); + throw new \InvalidArgumentException( + 'Missing the required parameter $username when calling getUserByName' + ); } $resourcePath = '/user/{username}'; @@ -1036,7 +1109,11 @@ protected function getUserByNameRequest($username) // path params if ($username !== null) { - $resourcePath = str_replace('{' . 'username' . '}', ObjectSerializer::toPathValue($username), $resourcePath); + $resourcePath = str_replace( + '{' . 'username' . '}', + ObjectSerializer::toPathValue($username), + $resourcePath + ); } @@ -1064,20 +1141,19 @@ protected function getUserByNameRequest($username) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -1089,9 +1165,10 @@ protected function getUserByNameRequest($username) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1148,7 +1225,11 @@ public function loginUserWithHttpInfo($username, $password) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -1174,7 +1255,11 @@ public function loginUserWithHttpInfo($username, $password) } catch (ApiException $e) { switch ($e->getCode()) { case 200: - $data = ObjectSerializer::deserialize($e->getResponseBody(), 'string', $e->getResponseHeaders()); + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string', + $e->getResponseHeaders() + ); $e->setResponseObject($data); break; } @@ -1195,9 +1280,10 @@ public function loginUserWithHttpInfo($username, $password) */ public function loginUserAsync($username, $password) { - return $this->loginUserAsyncWithHttpInfo($username, $password)->then(function ($response) { - return $response[0]; - }); + return $this->loginUserAsyncWithHttpInfo($username, $password) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -1216,32 +1302,38 @@ public function loginUserAsyncWithHttpInfo($username, $password) $returnType = 'string'; $request = $this->loginUserRequest($username, $password); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -1257,11 +1349,15 @@ protected function loginUserRequest($username, $password) { // verify the required parameter 'username' is set if ($username === null) { - throw new \InvalidArgumentException('Missing the required parameter $username when calling loginUser'); + throw new \InvalidArgumentException( + 'Missing the required parameter $username when calling loginUser' + ); } // verify the required parameter 'password' is set if ($password === null) { - throw new \InvalidArgumentException('Missing the required parameter $password when calling loginUser'); + throw new \InvalidArgumentException( + 'Missing the required parameter $password when calling loginUser' + ); } $resourcePath = '/user/login'; @@ -1306,20 +1402,19 @@ protected function loginUserRequest($username, $password) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -1331,9 +1426,10 @@ protected function loginUserRequest($username, $password) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1385,7 +1481,11 @@ public function logoutUserWithHttpInfo() if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -1412,9 +1512,10 @@ public function logoutUserWithHttpInfo() */ public function logoutUserAsync() { - return $this->logoutUserAsyncWithHttpInfo()->then(function ($response) { - return $response[0]; - }); + return $this->logoutUserAsyncWithHttpInfo() + ->then(function ($response) { + return $response[0]; + }); } /** @@ -1431,18 +1532,24 @@ public function logoutUserAsyncWithHttpInfo() $returnType = ''; $request = $this->logoutUserRequest(); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -1489,20 +1596,19 @@ protected function logoutUserRequest() 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -1514,9 +1620,10 @@ protected function logoutUserRequest() $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'GET', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1572,7 +1679,11 @@ public function updateUserWithHttpInfo($username, $body) if ($statusCode < 200 || $statusCode > 299) { throw new ApiException( - "[$statusCode] Error connecting to the API ({$request->getUri()})", + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), $statusCode, $response->getHeaders(), $response->getBody() @@ -1601,9 +1712,10 @@ public function updateUserWithHttpInfo($username, $body) */ public function updateUserAsync($username, $body) { - return $this->updateUserAsyncWithHttpInfo($username, $body)->then(function ($response) { - return $response[0]; - }); + return $this->updateUserAsyncWithHttpInfo($username, $body) + ->then(function ($response) { + return $response[0]; + }); } /** @@ -1622,18 +1734,24 @@ public function updateUserAsyncWithHttpInfo($username, $body) $returnType = ''; $request = $this->updateUserRequest($username, $body); - return $this->client->sendAsync($request)->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - "[$statusCode] Error connecting to the API ({$exception->getRequest()->getUri()})", - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + return $this->client + ->sendAsync($request) + ->then(function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + }); } /** @@ -1649,11 +1767,15 @@ protected function updateUserRequest($username, $body) { // verify the required parameter 'username' is set if ($username === null) { - throw new \InvalidArgumentException('Missing the required parameter $username when calling updateUser'); + throw new \InvalidArgumentException( + 'Missing the required parameter $username when calling updateUser' + ); } // verify the required parameter 'body' is set if ($body === null) { - throw new \InvalidArgumentException('Missing the required parameter $body when calling updateUser'); + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling updateUser' + ); } $resourcePath = '/user/{username}'; @@ -1666,7 +1788,11 @@ protected function updateUserRequest($username, $body) // path params if ($username !== null) { - $resourcePath = str_replace('{' . 'username' . '}', ObjectSerializer::toPathValue($username), $resourcePath); + $resourcePath = str_replace( + '{' . 'username' . '}', + ObjectSerializer::toPathValue($username), + $resourcePath + ); } // body params @@ -1699,20 +1825,19 @@ protected function updateUserRequest($username, $body) 'contents' => $formParamValue ]; } - $httpBody = new MultipartStream($multipartContents); // for HTTP post (form) + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); } elseif ($headers['Content-Type'] === 'application/json') { $httpBody = \GuzzleHttp\json_encode($formParams); } else { - $httpBody = \GuzzleHttp\Psr7\build_query($formParams); // for HTTP post (form) + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); } } - $query = \GuzzleHttp\Psr7\build_query($queryParams); - $url = $this->config->getHost() . $resourcePath . ($query ? '?' . $query : ''); - $defaultHeaders = []; if ($this->config->getUserAgent()) { $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); @@ -1724,9 +1849,10 @@ protected function updateUserRequest($username, $body) $headers ); + $query = \GuzzleHttp\Psr7\build_query($queryParams); return new Request( 'PUT', - $url, + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); From 432f5789b037c00013fd18dc1ce6f17341217ef3 Mon Sep 17 00:00:00 2001 From: "akihito.nakano" Date: Sat, 16 Sep 2017 14:04:40 +0900 Subject: [PATCH 4/5] Fix undefined variable $_tempBody --- .../src/main/resources/php/api.mustache | 2 +- .../php/SwaggerClient-php/lib/Api/FakeApi.php | 2 ++ .../php/SwaggerClient-php/lib/Api/FakeApi.php | 6 ++++++ .../php/SwaggerClient-php/lib/Api/PetApi.php | 12 ++++++++++++ .../php/SwaggerClient-php/lib/Api/StoreApi.php | 6 ++++++ .../php/SwaggerClient-php/lib/Api/UserApi.php | 8 ++++++++ 6 files changed, 35 insertions(+), 1 deletion(-) diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index 037330692f3..ab899214e92 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -391,9 +391,9 @@ use {{invokerPackage}}\ObjectSerializer; {{/isFile}} } {{/formParams}} - {{#bodyParams}} // body params $_tempBody = null; + {{#bodyParams}} if (isset(${{paramName}})) { $_tempBody = ${{paramName}}; } diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php index 98df6cbe19a..4a2387723a8 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -226,6 +226,8 @@ protected function testCodeInjectEndRnNRRequest($test_code_inject____end____rn_n if ($test_code_inject____end____rn_n_r !== null) { $formParams['test code inject */ ' " =end -- \r\n \n \r'] = ObjectSerializer::toFormValue($test_code_inject____end____rn_n_r); } + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index 303ed18f92b..fe534189988 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -1609,6 +1609,8 @@ protected function testEndpointParametersRequest($number, $double, $pattern_with if ($callback !== null) { $formParams['callback'] = ObjectSerializer::toFormValue($callback); } + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( @@ -1885,6 +1887,8 @@ protected function testEnumParametersRequest($enum_form_string_array = null, $en if ($enum_query_double !== null) { $formParams['enum_query_double'] = ObjectSerializer::toFormValue($enum_query_double); } + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( @@ -2109,6 +2113,8 @@ protected function testJsonFormDataRequest($param, $param2) if ($param2 !== null) { $formParams['param2'] = ObjectSerializer::toFormValue($param2); } + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php index 511ebbf91d3..f6129df8890 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -459,6 +459,8 @@ protected function deletePetRequest($pet_id, $api_key = null) ); } + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( @@ -712,6 +714,8 @@ protected function findPetsByStatusRequest($status) } + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( @@ -965,6 +969,8 @@ protected function findPetsByTagsRequest($tags) } + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( @@ -1219,6 +1225,8 @@ protected function getPetByIdRequest($pet_id) ); } + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( @@ -1669,6 +1677,8 @@ protected function updatePetWithFormRequest($pet_id, $name = null, $status = nul if ($status !== null) { $formParams['status'] = ObjectSerializer::toFormValue($status); } + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( @@ -1942,6 +1952,8 @@ protected function uploadFileRequest($pet_id, $additional_metadata = null, $file $multipart = true; $formParams['file'] = \GuzzleHttp\Psr7\try_fopen(ObjectSerializer::toFormValue($file), 'rb'); } + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php index 641ca401df1..2b8b25b339a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -236,6 +236,8 @@ protected function deleteOrderRequest($order_id) ); } + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( @@ -467,6 +469,8 @@ protected function getInventoryRequest() + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( @@ -729,6 +733,8 @@ protected function getOrderByIdRequest($order_id) ); } + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php index 24e40404a08..ccd8002f1e1 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -866,6 +866,8 @@ protected function deleteUserRequest($username) ); } + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( @@ -1116,6 +1118,8 @@ protected function getUserByNameRequest($username) ); } + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( @@ -1377,6 +1381,8 @@ protected function loginUserRequest($username, $password) } + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( @@ -1571,6 +1577,8 @@ protected function logoutUserRequest() + // body params + $_tempBody = null; if ($multipart) { $headers= $this->headerSelector->selectHeadersForMultipart( From f55808a0f744108735c0bfb9904834548eabd146 Mon Sep 17 00:00:00 2001 From: "akihito.nakano" Date: Sat, 16 Sep 2017 14:10:11 +0900 Subject: [PATCH 5/5] Improve indent --- .../src/main/resources/php/api.mustache | 73 +-- .../php/SwaggerClient-php/lib/Api/FakeApi.php | 41 +- .../lib/Api/AnotherFakeApi.php | 65 +-- .../php/SwaggerClient-php/lib/Api/FakeApi.php | 448 ++++++++++-------- .../lib/Api/Fake_classname_tags123Api.php | 65 +-- .../php/SwaggerClient-php/lib/Api/PetApi.php | 424 +++++++++-------- .../SwaggerClient-php/lib/Api/StoreApi.php | 236 ++++----- .../php/SwaggerClient-php/lib/Api/UserApi.php | 376 ++++++++------- 8 files changed, 944 insertions(+), 784 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index ab899214e92..a2247273df0 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -207,9 +207,11 @@ use {{invokerPackage}}\ObjectSerializer; public function {{operationId}}Async({{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}'{{{.}}}'{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { return $this->{{operationId}}AsyncWithHttpInfo({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -235,41 +237,44 @@ use {{invokerPackage}}\ObjectSerializer; return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - {{#returnType}} - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + {{#returnType}} + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - {{/returnType}} - {{^returnType}} - return [null, $response->getStatusCode(), $response->getHeaders()]; + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + {{/returnType}} + {{^returnType}} + return [null, $response->getStatusCode(), $response->getHeaders()]; {{/returnType}} - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** diff --git a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php index 4a2387723a8..6c4e0ae1c9d 100644 --- a/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore-security-test/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -162,9 +162,11 @@ public function testCodeInjectEndRnNRWithHttpInfo($test_code_inject____end____rn public function testCodeInjectEndRnNRAsync($test_code_inject____end____rn_n_r = null) { return $this->testCodeInjectEndRnNRAsyncWithHttpInfo($test_code_inject____end____rn_n_r) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -184,22 +186,25 @@ public function testCodeInjectEndRnNRAsyncWithHttpInfo($test_code_inject____end_ return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/AnotherFakeApi.php index 39719739c53..5e5ba412dd9 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/AnotherFakeApi.php @@ -185,9 +185,11 @@ public function testSpecialTagsWithHttpInfo($body) public function testSpecialTagsAsync($body) { return $this->testSpecialTagsAsyncWithHttpInfo($body) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -207,36 +209,39 @@ public function testSpecialTagsAsyncWithHttpInfo($body) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index fe534189988..9da96303010 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -181,9 +181,11 @@ public function fakeOuterBooleanSerializeWithHttpInfo($body = null) public function fakeOuterBooleanSerializeAsync($body = null) { return $this->fakeOuterBooleanSerializeAsyncWithHttpInfo($body) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -203,36 +205,39 @@ public function fakeOuterBooleanSerializeAsyncWithHttpInfo($body = null) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -418,9 +423,11 @@ public function fakeOuterCompositeSerializeWithHttpInfo($body = null) public function fakeOuterCompositeSerializeAsync($body = null) { return $this->fakeOuterCompositeSerializeAsyncWithHttpInfo($body) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -440,36 +447,39 @@ public function fakeOuterCompositeSerializeAsyncWithHttpInfo($body = null) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -655,9 +665,11 @@ public function fakeOuterNumberSerializeWithHttpInfo($body = null) public function fakeOuterNumberSerializeAsync($body = null) { return $this->fakeOuterNumberSerializeAsyncWithHttpInfo($body) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -677,36 +689,39 @@ public function fakeOuterNumberSerializeAsyncWithHttpInfo($body = null) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -892,9 +907,11 @@ public function fakeOuterStringSerializeWithHttpInfo($body = null) public function fakeOuterStringSerializeAsync($body = null) { return $this->fakeOuterStringSerializeAsyncWithHttpInfo($body) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -914,36 +931,39 @@ public function fakeOuterStringSerializeAsyncWithHttpInfo($body = null) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -1133,9 +1153,11 @@ public function testClientModelWithHttpInfo($body) public function testClientModelAsync($body) { return $this->testClientModelAsyncWithHttpInfo($body) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -1155,36 +1177,39 @@ public function testClientModelAsyncWithHttpInfo($body) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -1396,9 +1421,11 @@ public function testEndpointParametersWithHttpInfo($number, $double, $pattern_wi public function testEndpointParametersAsync($number, $double, $pattern_without_delimiter, $byte, $integer = null, $int32 = null, $int64 = null, $float = null, $string = null, $binary = null, $date = null, $date_time = null, $password = null, $callback = null) { return $this->testEndpointParametersAsyncWithHttpInfo($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -1431,22 +1458,25 @@ public function testEndpointParametersAsyncWithHttpInfo($number, $double, $patte return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -1775,9 +1805,11 @@ public function testEnumParametersWithHttpInfo($enum_form_string_array = null, $ public function testEnumParametersAsync($enum_form_string_array = null, $enum_form_string = '-efg', $enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null) { return $this->testEnumParametersAsyncWithHttpInfo($enum_form_string_array, $enum_form_string, $enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -1804,22 +1836,25 @@ public function testEnumParametersAsyncWithHttpInfo($enum_form_string_array = nu return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -2031,9 +2066,11 @@ public function testJsonFormDataWithHttpInfo($param, $param2) public function testJsonFormDataAsync($param, $param2) { return $this->testJsonFormDataAsyncWithHttpInfo($param, $param2) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -2054,22 +2091,25 @@ public function testJsonFormDataAsyncWithHttpInfo($param, $param2) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/Fake_classname_tags123Api.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/Fake_classname_tags123Api.php index b7df0bd3d62..dd25d6ae6f7 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/Fake_classname_tags123Api.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/Fake_classname_tags123Api.php @@ -185,9 +185,11 @@ public function testClassnameWithHttpInfo($body) public function testClassnameAsync($body) { return $this->testClassnameAsyncWithHttpInfo($body) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -207,36 +209,39 @@ public function testClassnameAsyncWithHttpInfo($body) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php index f6129df8890..6a8439906bf 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -162,9 +162,11 @@ public function addPetWithHttpInfo($body) public function addPetAsync($body) { return $this->addPetAsyncWithHttpInfo($body) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -184,22 +186,25 @@ public function addPetAsyncWithHttpInfo($body) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -379,9 +384,11 @@ public function deletePetWithHttpInfo($pet_id, $api_key = null) public function deletePetAsync($pet_id, $api_key = null) { return $this->deletePetAsyncWithHttpInfo($pet_id, $api_key) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -402,22 +409,25 @@ public function deletePetAsyncWithHttpInfo($pet_id, $api_key = null) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -627,9 +637,11 @@ public function findPetsByStatusWithHttpInfo($status) public function findPetsByStatusAsync($status) { return $this->findPetsByStatusAsyncWithHttpInfo($status) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -649,36 +661,39 @@ public function findPetsByStatusAsyncWithHttpInfo($status) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -882,9 +897,11 @@ public function findPetsByTagsWithHttpInfo($tags) public function findPetsByTagsAsync($tags) { return $this->findPetsByTagsAsyncWithHttpInfo($tags) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -904,36 +921,39 @@ public function findPetsByTagsAsyncWithHttpInfo($tags) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -1137,9 +1157,11 @@ public function getPetByIdWithHttpInfo($pet_id) public function getPetByIdAsync($pet_id) { return $this->getPetByIdAsyncWithHttpInfo($pet_id) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -1159,36 +1181,39 @@ public function getPetByIdAsyncWithHttpInfo($pet_id) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -1371,9 +1396,11 @@ public function updatePetWithHttpInfo($body) public function updatePetAsync($body) { return $this->updatePetAsyncWithHttpInfo($body) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -1393,22 +1420,25 @@ public function updatePetAsyncWithHttpInfo($body) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -1591,9 +1621,11 @@ public function updatePetWithFormWithHttpInfo($pet_id, $name = null, $status = n public function updatePetWithFormAsync($pet_id, $name = null, $status = null) { return $this->updatePetWithFormAsyncWithHttpInfo($pet_id, $name, $status) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -1615,22 +1647,25 @@ public function updatePetWithFormAsyncWithHttpInfo($pet_id, $name = null, $statu return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -1851,9 +1886,11 @@ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $fi public function uploadFileAsync($pet_id, $additional_metadata = null, $file = null) { return $this->uploadFileAsyncWithHttpInfo($pet_id, $additional_metadata, $file) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -1875,36 +1912,39 @@ public function uploadFileAsyncWithHttpInfo($pet_id, $additional_metadata = null return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php index 2b8b25b339a..3587448cd7a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -162,9 +162,11 @@ public function deleteOrderWithHttpInfo($order_id) public function deleteOrderAsync($order_id) { return $this->deleteOrderAsyncWithHttpInfo($order_id) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -184,22 +186,25 @@ public function deleteOrderAsyncWithHttpInfo($order_id) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -397,9 +402,11 @@ public function getInventoryWithHttpInfo() public function getInventoryAsync() { return $this->getInventoryAsyncWithHttpInfo() - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -418,36 +425,39 @@ public function getInventoryAsyncWithHttpInfo() return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -638,9 +648,11 @@ public function getOrderByIdWithHttpInfo($order_id) public function getOrderByIdAsync($order_id) { return $this->getOrderByIdAsyncWithHttpInfo($order_id) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -660,36 +672,39 @@ public function getOrderByIdAsyncWithHttpInfo($order_id) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -897,9 +912,11 @@ public function placeOrderWithHttpInfo($body) public function placeOrderAsync($body) { return $this->placeOrderAsyncWithHttpInfo($body) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -919,36 +936,39 @@ public function placeOrderAsyncWithHttpInfo($body) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php index ccd8002f1e1..5d4fe8e7120 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -162,9 +162,11 @@ public function createUserWithHttpInfo($body) public function createUserAsync($body) { return $this->createUserAsyncWithHttpInfo($body) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -184,22 +186,25 @@ public function createUserAsyncWithHttpInfo($body) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -372,9 +377,11 @@ public function createUsersWithArrayInputWithHttpInfo($body) public function createUsersWithArrayInputAsync($body) { return $this->createUsersWithArrayInputAsyncWithHttpInfo($body) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -394,22 +401,25 @@ public function createUsersWithArrayInputAsyncWithHttpInfo($body) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -582,9 +592,11 @@ public function createUsersWithListInputWithHttpInfo($body) public function createUsersWithListInputAsync($body) { return $this->createUsersWithListInputAsyncWithHttpInfo($body) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -604,22 +616,25 @@ public function createUsersWithListInputAsyncWithHttpInfo($body) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -792,9 +807,11 @@ public function deleteUserWithHttpInfo($username) public function deleteUserAsync($username) { return $this->deleteUserAsyncWithHttpInfo($username) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -814,22 +831,25 @@ public function deleteUserAsyncWithHttpInfo($username) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -1030,9 +1050,11 @@ public function getUserByNameWithHttpInfo($username) public function getUserByNameAsync($username) { return $this->getUserByNameAsyncWithHttpInfo($username) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -1052,36 +1074,39 @@ public function getUserByNameAsyncWithHttpInfo($username) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -1285,9 +1310,11 @@ public function loginUserWithHttpInfo($username, $password) public function loginUserAsync($username, $password) { return $this->loginUserAsyncWithHttpInfo($username, $password) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -1308,36 +1335,39 @@ public function loginUserAsyncWithHttpInfo($username, $password) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - $responseBody = $response->getBody(); - if ($returnType === '\SplFileObject') { - $content = $responseBody; //stream goes to serializer - } else { - $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = $responseBody->getContents(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } - } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -1519,9 +1549,11 @@ public function logoutUserWithHttpInfo() public function logoutUserAsync() { return $this->logoutUserAsyncWithHttpInfo() - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -1540,22 +1572,25 @@ public function logoutUserAsyncWithHttpInfo() return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /** @@ -1721,9 +1756,11 @@ public function updateUserWithHttpInfo($username, $body) public function updateUserAsync($username, $body) { return $this->updateUserAsyncWithHttpInfo($username, $body) - ->then(function ($response) { - return $response[0]; - }); + ->then( + function ($response) { + return $response[0]; + } + ); } /** @@ -1744,22 +1781,25 @@ public function updateUserAsyncWithHttpInfo($username, $body) return $this->client ->sendAsync($request) - ->then(function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - $response->getBody() - ); - }); + $response->getHeaders(), + $response->getBody() + ); + } + ); } /**