Skip to content

Commit 4c81563

Browse files
committed
Update PHP samples
1 parent 5902af4 commit 4c81563

File tree

2 files changed

+26
-24
lines changed
  • samples/client/petstore

2 files changed

+26
-24
lines changed

samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -549,18 +549,6 @@ public function fakeEnumEndpointWithHttpInfo(
549549

550550
$statusCode = $response->getStatusCode();
551551

552-
if ($statusCode < 200 || $statusCode > 299) {
553-
throw new ApiException(
554-
sprintf(
555-
'[%d] Error connecting to the API (%s)',
556-
$statusCode,
557-
(string) $request->getUri()
558-
),
559-
$statusCode,
560-
$response->getHeaders(),
561-
(string) $response->getBody()
562-
);
563-
}
564552

565553
switch($statusCode) {
566554
case 200:
@@ -592,6 +580,19 @@ public function fakeEnumEndpointWithHttpInfo(
592580
];
593581
}
594582

583+
if ($statusCode < 200 || $statusCode > 299) {
584+
throw new ApiException(
585+
sprintf(
586+
'[%d] Error connecting to the API (%s)',
587+
$statusCode,
588+
(string) $request->getUri()
589+
),
590+
$statusCode,
591+
$response->getHeaders(),
592+
(string) $response->getBody()
593+
);
594+
}
595+
595596
$returnType = '\OpenAPI\Client\Model\EnumClass';
596597
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
597598
$content = $response->getBody(); //stream goes to serializer

samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -529,18 +529,6 @@ public function fakeEnumEndpointWithHttpInfo($enum_class, $enum_class_array, $en
529529

530530
$statusCode = $response->getStatusCode();
531531

532-
if ($statusCode < 200 || $statusCode > 299) {
533-
throw new ApiException(
534-
sprintf(
535-
'[%d] Error connecting to the API (%s)',
536-
$statusCode,
537-
(string) $request->getUri()
538-
),
539-
$statusCode,
540-
$response->getHeaders(),
541-
(string) $response->getBody()
542-
);
543-
}
544532

545533
switch($statusCode) {
546534
case 200:
@@ -572,6 +560,19 @@ public function fakeEnumEndpointWithHttpInfo($enum_class, $enum_class_array, $en
572560
];
573561
}
574562

563+
if ($statusCode < 200 || $statusCode > 299) {
564+
throw new ApiException(
565+
sprintf(
566+
'[%d] Error connecting to the API (%s)',
567+
$statusCode,
568+
(string) $request->getUri()
569+
),
570+
$statusCode,
571+
$response->getHeaders(),
572+
(string) $response->getBody()
573+
);
574+
}
575+
575576
$returnType = '\OpenAPI\Client\Model\EnumClass';
576577
if ($returnType === '\SplFileObject') {
577578
$content = $response->getBody(); //stream goes to serializer

0 commit comments

Comments
 (0)