Skip to content

Commit 1bd1a4c

Browse files
committed
refactor: cast to string response body
1 parent 9c68bfb commit 1bd1a4c

File tree

4 files changed

+3
-75
lines changed

4 files changed

+3
-75
lines changed

src/Response/HandleResponse.php

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/Response/HttpStatusValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function validate(): void
5555
}
5656
case 200:
5757
{
58-
if (HandleResponse::getBody($this->response) == self::ERROR_NOT_FOUND_BODY) {
58+
if ((string) $this->response->getBody() == self::ERROR_NOT_FOUND_BODY) {
5959
throw new FunctionNotFoundException();
6060
}
6161
break;
@@ -66,7 +66,7 @@ public function validate(): void
6666
sprintf(
6767
self::SOMETHING_WENT_WRONG,
6868
$statusCode,
69-
HandleResponse::getBody($this->response)
69+
(string) $this->response->getBody()
7070
)
7171
);
7272
}

src/Service/MtaService.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Http\Message\Authentication\BasicAuth;
1818
use MultiTheftAuto\Sdk\Model\Authentication;
1919
use MultiTheftAuto\Sdk\Model\Server;
20-
use MultiTheftAuto\Sdk\Response\HandleResponse;
2120
use MultiTheftAuto\Sdk\Response\HttpStatusValidator;
2221
use MultiTheftAuto\Sdk\Transformer\ElementTransformer;
2322
use Psr\Http\Client\ClientInterface;
@@ -89,7 +88,7 @@ public function callFunction(string $resourceName, string $functionName, array $
8988
$statusValidator = new HttpStatusValidator($response);
9089
$statusValidator->validate();
9190

92-
$responseBody = HandleResponse::getBody($response);
91+
$responseBody = (string) $response->getBody();
9392

9493
return ElementTransformer::fromServer($responseBody) ?? null;
9594
}

tests/Unit/Response/HandleResponseTest.php

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)