From 339610d2b96ee0227c39d342b92c45b452acfeeb Mon Sep 17 00:00:00 2001 From: "Erik Trapin (ecoologic)" Date: Tue, 14 Nov 2023 15:05:30 +1000 Subject: [PATCH] Doc PaginationIterator --- .../Utility/Pagination/AbstractStrategy.php | 10 ++++++++++ .../Utility/Pagination/PaginationIterator.php | 15 +++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Zendesk/API/Traits/Utility/Pagination/AbstractStrategy.php b/src/Zendesk/API/Traits/Utility/Pagination/AbstractStrategy.php index 227a9d24..f0a954f3 100644 --- a/src/Zendesk/API/Traits/Utility/Pagination/AbstractStrategy.php +++ b/src/Zendesk/API/Traits/Utility/Pagination/AbstractStrategy.php @@ -22,11 +22,21 @@ public function params() return $this->params; } + /** + * Returns the latest HTTP response, unless an error occurred, which causes an exception + * + * @return \GuzzleHttp\Psr7\Response + */ public function latestResponse() { return $this->latestResponse; } + /** + * From the params or the default value + * + * @return integer + */ protected function pageSize() { if (isset($this->pageSize)) { diff --git a/src/Zendesk/API/Traits/Utility/Pagination/PaginationIterator.php b/src/Zendesk/API/Traits/Utility/Pagination/PaginationIterator.php index c99f14a8..bb6f664e 100644 --- a/src/Zendesk/API/Traits/Utility/Pagination/PaginationIterator.php +++ b/src/Zendesk/API/Traits/Utility/Pagination/PaginationIterator.php @@ -8,16 +8,18 @@ class PaginationIterator implements Iterator { - /** - * @var mixed using trait FindAll. The object handling the list, Ie: `$client->{clientList}()` - * Eg: `$client->tickets()` which uses FindAll - */ private $clientList; private $strategy; private $method; private $position = 0; private $items = []; + /** + * + * @param mixed using trait FindAll. The resources collection, Eg: `$client->tickets()` which uses FindAll + * @param AbstractStrategy $strategy For pagination Logic (OBP, CBP, SinglePage) + * @param string $method used to make the API call + */ public function __construct($clientList, AbstractStrategy $strategy, $method = 'findAll') { $this->clientList = $clientList; @@ -55,6 +57,11 @@ public function current() } } + /** + * Returns the latest HTTP response, unless an error occurred, which causes an exception + * + * @return \GuzzleHttp\Psr7\Response + */ public function latestResponse() { return $this->strategy->latestResponse();