@@ -188,7 +188,7 @@ use {{invokerPackage}}\ObjectSerializer;
188188
189189{ {#operation} }
190190 /**
191- * Operation { {{operationId} }}
191+ * Operation { {{operationId} }}.
192192{ {#summary} }
193193 *
194194 * { {.} }
@@ -339,12 +339,12 @@ use {{invokerPackage}}\ObjectSerializer;
339339 $content = (string) $response -> getBody ();
340340 if (' {{{dataType}}}' !== ' string' ) {
341341 try {
342- $content = json_decode($content , false , 512, JSON_THROW_ON_ERROR);
342+ $content = json_decode($content , false , 512, \ JSON_THROW_ON_ERROR);
343343 } catch (\JsonException $exception) {
344344 throw new ApiException(
345345 sprintf(
346346 ' Error JSON decoding server response (%s)' ,
347- $request -> getUri ()
347+ $request -> getUri (),
348348 ),
349349 $statusCode ,
350350 $response -> getHeaders (),
@@ -357,7 +357,7 @@ use {{invokerPackage}}\ObjectSerializer;
357357 return [
358358 ObjectSerializer::deserialize($content, '{ {{dataType} }}', []),
359359 $response->getStatusCode(),
360- $response->getHeaders()
360+ $response->getHeaders(),
361361 ];{ {/isRange} }
362362 { {/dataType} }
363363 { {#-last} }
@@ -370,31 +370,31 @@ use {{invokerPackage}}\ObjectSerializer;
370370 sprintf(
371371 ' [%d] Error connecting to the API (%s)' ,
372372 $statusCode ,
373- (string) $request -> getUri ()
373+ (string) $request -> getUri (),
374374 ),
375375 $statusCode ,
376376 $response -> getHeaders (),
377- (string) $response -> getBody ()
377+ (string) $response -> getBody (),
378378 );
379379 }
380380
381381 $returnType = '{ {{returnType} }}';
382382 if ($returnType === '\SplFileObject') {
383- $content = $response -> getBody (); //stream goes to serializer
383+ $content = $response -> getBody (); // stream goes to serializer
384384 } else {
385385 $content = (string) $response -> getBody ();
386386 if ($returnType !== ' string' ) {
387387 try {
388- $content = json_decode($content , false , 512, JSON_THROW_ON_ERROR);
388+ $content = json_decode($content , false , 512, \ JSON_THROW_ON_ERROR);
389389 } catch (\JsonException $exception) {
390390 throw new ApiException(
391391 sprintf(
392392 ' Error JSON decoding server response (%s)' ,
393- $request -> getUri ()
393+ $request -> getUri (),
394394 ),
395395 $statusCode ,
396396 $response -> getHeaders (),
397- $content
397+ $content ,
398398 );
399399 }
400400 }
@@ -419,9 +419,10 @@ use {{invokerPackage}}\ObjectSerializer;
419419 $data = ObjectSerializer::deserialize(
420420 $e->getResponseBody(),
421421 '{ {{dataType} }}',
422- $e->getResponseHeaders()
422+ $e->getResponseHeaders(),
423423 );
424424 $e->setResponseObject($data);
425+
425426 break;{ {/isRange} }
426427 { {/dataType} }
427428 { {/responses} }
@@ -662,12 +663,12 @@ use {{invokerPackage}}\ObjectSerializer;
662663 { {/required} }
663664 { {#hasValidation} }
664665 { {#maxLength} }
665- if ({ {^required} }${ {paramName} } !== null && { {/required} }strlen((string)${ {paramName} }) > { {maxLength} }) {
666+ if ({ {^required} }${ {paramName} } !== null && { {/required} }\ strlen((string) ${ {paramName} }) > { {maxLength} }) {
666667 throw new \InvalidArgumentException(' invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.' );
667668 }
668669 { {/maxLength} }
669670 { {#minLength} }
670- if ({ {^required} }${ {paramName} } !== null && { {/required} }strlen((string)${ {paramName} }) < { {minLength} }) {
671+ if ({ {^required} }${ {paramName} } !== null && { {/required} }\ strlen((string) ${ {paramName} }) < { {minLength} }) {
671672 throw new \InvalidArgumentException(' invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.' );
672673 }
673674 { {/minLength} }
@@ -716,7 +717,7 @@ use {{invokerPackage}}\ObjectSerializer;
716717 '{ {#schema} }{ {openApiType} }{ {/schema} }', // openApiType
717718 '{ {style} }', // style
718719 { {#isExplode} }true{ {/isExplode} }{ {^isExplode} }false{ {/isExplode} }, // explode
719- { {required} } // required
720+ { {required} }, // required
720721 ) ?? []);
721722 { {/queryParams} }
722723
@@ -741,7 +742,7 @@ use {{invokerPackage}}\ObjectSerializer;
741742 { {/collectionFormat} }
742743 if (${ {paramName} } !== null) {
743744 $resourcePath = str_replace(
744- ' {' . ' {{baseName}}' . ' }' ,
745+ ' {' . ' {{baseName}}' . ' }' ,
745746 ObjectSerializer::toPathValue(${{paramName} }),
746747 $resourcePath
747748 );
@@ -781,15 +782,15 @@ use {{invokerPackage}}\ObjectSerializer;
781782 { {#bodyParams} }
782783 if (isset(${ {paramName} })) {
783784 if (stripos($headers [' Content-Type' ], ' application/json' ) !== false ) {
784- # if Content-Type contains " application/json" , json_encode the body
785+ // if Content-Type contains " application/json" , json_encode the body
785786 $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization(${{paramName} }));
786787 } else {
787788 $httpBody = ${{paramName} };
788789 }
789790 } elseif (count($formParams) > 0) {
790791 {{/bodyParams} }
791792 { {^bodyParams} }
792- if (count($formParams) > 0) {
793+ if (\ count($formParams) > 0) {
793794 {{/bodyParams} }
794795 if ($multipart) {
795796 $multipartContents = [];
@@ -806,7 +807,7 @@ use {{invokerPackage}}\ObjectSerializer;
806807 $httpBody = new MultipartStream($multipartContents);
807808
808809 } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
809- # if Content-Type contains " application/json" , json_encode the form parameters
810+ // if Content-Type contains " application/json" , json_encode the form parameters
810811 $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams );
811812 } else {
812813 // for HTTP post (form)
@@ -826,20 +827,20 @@ use {{invokerPackage}}\ObjectSerializer;
826827 { {#isBasicBasic} }
827828 // this endpoint requires HTTP basic authentication
828829 if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
829- $headers [' Authorization' ] = ' Basic ' . base64_encode($this -> config -> getUsername () . " :" . $this -> config -> getPassword ());
830+ $headers [' Authorization' ] = ' Basic ' . base64_encode($this -> config -> getUsername (). " :" . $this -> config -> getPassword ());
830831 }
831832 { {/isBasicBasic} }
832833 { {#isBasicBearer} }
833834 // this endpoint requires Bearer{ {#bearerFormat} } ({ {{.} }}){ {/bearerFormat} } authentication (access token)
834835 if (!empty($this->config->getAccessToken())) {
835- $headers [' Authorization' ] = ' Bearer ' . $this -> config -> getAccessToken ();
836+ $headers [' Authorization' ] = ' Bearer ' . $this -> config -> getAccessToken ();
836837 }
837838 { {/isBasicBearer} }
838839 { {/isBasic} }
839840 { {#isOAuth} }
840841 // this endpoint requires OAuth (access token)
841842 if (!empty($this->config->getAccessToken())) {
842- $headers [' Authorization' ] = ' Bearer ' . $this -> config -> getAccessToken ();
843+ $headers [' Authorization' ] = ' Bearer ' . $this -> config -> getAccessToken ();
843844 }
844845 { {/isOAuth} }
845846 { {/authMethods} }
@@ -852,7 +853,7 @@ use {{invokerPackage}}\ObjectSerializer;
852853 $headers = array_merge(
853854 $defaultHeaders,
854855 $headerParams,
855- $headers
856+ $headers,
856857 );
857858
858859 { {#servers.0} }
@@ -874,9 +875,9 @@ use {{invokerPackage}}\ObjectSerializer;
874875 $query = ObjectSerializer::buildQuery($queryParams);
875876 return new Request(
876877 '{ {httpMethod} }',
877- $operationHost . $resourcePath . ($query ? "?{ $query } " : ''),
878+ $operationHost. $resourcePath. ($query ? "?{ $query } " : ''),
878879 $headers,
879- $httpBody
880+ $httpBody,
880881 );
881882 }
882883
0 commit comments