mirror of
https://github.com/retailcrm/mailgun-php.git
synced 2024-11-22 12:36:02 +03:00
Implement getTotalCount and add doc descriptions (#393)
* Implement getTotalCount and add doc descriptions * Use camelCase and store in private var * Removed extra calls to count()
This commit is contained in:
parent
2078321504
commit
b415076e45
@ -21,11 +21,25 @@ final class IndexResponse implements ApiResponse, PagingProvider
|
||||
use PaginationResponse;
|
||||
|
||||
/**
|
||||
* Array to store a list of Unsubscribe items from
|
||||
* index response
|
||||
*
|
||||
* @see Mailgun/Model/Suppression/Unsubscribe/Unsubscribe
|
||||
* @var Unsubscribe[]
|
||||
*/
|
||||
private $items;
|
||||
private $items = [];
|
||||
|
||||
/**
|
||||
* Store the total number of Unsubscribe items
|
||||
*
|
||||
* @see Mailgun/Model/Suppression/Unsubscribe/Unsubscribe
|
||||
* @var integer
|
||||
*/
|
||||
private $totalCount;
|
||||
|
||||
/**
|
||||
* @see Mailgun/Model/Suppression/Unsubscribe/Unsubscribe
|
||||
*
|
||||
* @param Unsubscribe[] $items
|
||||
* @param array $paging
|
||||
*/
|
||||
@ -36,6 +50,8 @@ final class IndexResponse implements ApiResponse, PagingProvider
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow create the unsubscribe items with paging
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return IndexResponse
|
||||
@ -53,10 +69,30 @@ final class IndexResponse implements ApiResponse, PagingProvider
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Unsusbscribe item models from the response
|
||||
*
|
||||
* @see Mailgun/Model/Suppression/Unsubscribe/Unsubscribe
|
||||
*
|
||||
* @return Unsubscribe[]
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the total count of Unsusbscribe in index response
|
||||
*
|
||||
* @see Mailgun/Model/Suppression/Unsubscribe/Unsubscribe
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getTotalCount()
|
||||
{
|
||||
if (null === $this->totalCount) {
|
||||
$this->totalCount = count($this->items);
|
||||
}
|
||||
|
||||
return $this->totalCount;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user