Skip to content

Commit 4749208

Browse files
authored
Update Clientable.php
1 parent 1c1fc82 commit 4749208

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Traits/Clientable.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ abstract public function getHttpClient();
2020

2121
abstract public function handleEmptyResponse(?string $content = null, ?\Psr\Http\Message\ResponseInterface $response = null);
2222

23-
abstract public function isErrorResponse(): bool;
23+
abstract public function isErrorResponse(array $data): bool;
2424

2525
abstract public function handleErrorResponse(?string $content = null, array $data = []);
2626

@@ -36,19 +36,19 @@ abstract public function getLastPage(): ?int;
3636

3737
abstract public function getDataList(): static|array|null;
3838

39-
public function castResponse(\Psr\Http\Message\ResponseInterface $response)
39+
public function castResponse($response)
4040
{
41-
$result = json_decode($content = $response->getBody()->getContents(), true) ?? [];
41+
$data = json_decode($content = $response->getBody()->getContents(), true) ?? [];
4242

43-
if (empty($result)) {
43+
if (empty($data)) {
4444
$this->handleEmptyResponse($content, $response);
4545
}
4646

47-
if ($this->isErrorResponse()) {
48-
$this->handleErrorResponse($content, $result);
47+
if ($this->isErrorResponse($data)) {
48+
$this->handleErrorResponse($content, $data);
4949
}
5050

51-
return $result;
51+
return $data;
5252
}
5353

5454
public function paginate()

0 commit comments

Comments
 (0)