Skip to content

Commit 3b2ea65

Browse files
authored
Update Clientable.php
1 parent cc37166 commit 3b2ea65

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/Traits/Clientable.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<?php
22

3-
/*
4-
* Fresns (https://fresns.org)
5-
* Copyright (C) 2021-Present Jarvis Tang
6-
*/
7-
83
namespace Plugins\FresnsEngine;
94

105
trait Clientable
@@ -41,9 +36,9 @@ abstract public function getLastPage(): ?int;
4136

4237
abstract public function getDataList(): static|array|null;
4338

44-
public function castResponse()
39+
public function castResponse($response)
4540
{
46-
$result = json_decode($content = $this->response->getBody()->getContents(), true) ?? [];
41+
$result = json_decode($content = $response->getBody()->getContents(), true) ?? [];
4742

4843
if (empty($result)) {
4944
$this->handleEmptyResponse($content);
@@ -81,7 +76,7 @@ public function __call($method, $args)
8176
{
8277
$this->response = $this->getHttpClient()->$method(...$args);
8378

84-
$this->result = $this->castResponse();
79+
$this->result = $this->castResponse($this->response);
8580

8681
$this->attributes = $this->result;
8782

0 commit comments

Comments
 (0)