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; }