From 9d81824b52dadc7b5fc0db9912373ecfb0942da7 Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 14 Aug 2024 22:18:57 +1000 Subject: [PATCH] Update ListList now that we pass an object with QueryResponse --- src/API.php | 2 +- src/Response/ListList.php | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/API.php b/src/API.php index a275cb4..296619c 100644 --- a/src/API.php +++ b/src/API.php @@ -305,7 +305,7 @@ final class API $key = 'Item'; $parameters['query'] = 'select * from Item'; - return new ListList($this->execute('query',$parameters),$key); + return new ListList($this->execute('query',$parameters,$key),$key); } /** diff --git a/src/Response/ListList.php b/src/Response/ListList.php index 4d6c0bf..4255442 100644 --- a/src/Response/ListList.php +++ b/src/Response/ListList.php @@ -144,9 +144,7 @@ class ListList extends Base implements \Countable, \ArrayAccess, \Iterator */ private function data(object $response,string $type): Collection { - if (! ($x=object_get($response->QueryResponse,$type))) - return collect(); - + $x = $response->{$type}; switch (Arr::get(self::TYPES,$type)) { case Category::class: $data = collect(Category::hydrate($x)); @@ -177,8 +175,8 @@ class ListList extends Base implements \Countable, \ArrayAccess, \Iterator throw new \Exception(sprintf('%s:Unknown object type: %s',self::LOGKEY,$type)); } - $this->startPosition = $response->QueryResponse->startPosition; - $this->maxResults = $response->QueryResponse->maxResults; + $this->startPosition = $response->startPosition; + $this->maxResults = $response->maxResults; return $data; }