Update PHP samples

This commit is contained in:
Bruno Coelho 2024-10-07 11:27:35 +01:00
parent 5902af4e75
commit 4c81563708
2 changed files with 26 additions and 24 deletions

View File

@ -549,18 +549,6 @@ class FakeApi
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
@ -592,6 +580,19 @@ class FakeApi
];
}
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
$returnType = '\OpenAPI\Client\Model\EnumClass';
if (in_array($returnType, ['\SplFileObject', '\Psr\Http\Message\StreamInterface'])) {
$content = $response->getBody(); //stream goes to serializer

View File

@ -529,18 +529,6 @@ class FakeApi
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
switch($statusCode) {
case 200:
@ -572,6 +560,19 @@ class FakeApi
];
}
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(
sprintf(
'[%d] Error connecting to the API (%s)',
$statusCode,
(string) $request->getUri()
),
$statusCode,
$response->getHeaders(),
(string) $response->getBody()
);
}
$returnType = '\OpenAPI\Client\Model\EnumClass';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer