class FixedSizeCollection implements IteratorAggregate

A collection of elements retrieved using one or more API calls. The collection will attempt to retrieve a fixed number of elements, and will make API calls until that fixed number is reached, or there are no more elements to retrieve.

Methods

__construct(Page $initialPage, integer $collectionSize)

FixedSizeCollection constructor.

int
getCollectionSize()

Returns the number of elements in the collection. This will be equal to the collectionSize parameter used at construction unless there are no elements remaining to be retrieved.

bool
hasNextCollection()

Returns true if there are more elements that can be retrieved from the API.

string
getNextPageToken()

Returns a page token that can be passed into the API list method to retrieve additional elements.

getNextCollection()

Retrieves the next FixedSizeCollection using one or more API calls.

getIterator()

Returns an iterator over the elements of the collection.

iterateCollections()

Returns an iterator over FixedSizeCollections, starting with this and making API calls as required until all of the elements have been retrieved.

Details

at line 55
__construct(Page $initialPage, integer $collectionSize)

FixedSizeCollection constructor.

Parameters

Page $initialPage
integer $collectionSize

at line 82
int getCollectionSize()

Returns the number of elements in the collection. This will be equal to the collectionSize parameter used at construction unless there are no elements remaining to be retrieved.

Return Value

int

at line 97
bool hasNextCollection()

Returns true if there are more elements that can be retrieved from the API.

Return Value

bool

at line 108
string getNextPageToken()

Returns a page token that can be passed into the API list method to retrieve additional elements.

Return Value

string

at line 118
FixedSizeCollection getNextCollection()

Retrieves the next FixedSizeCollection using one or more API calls.

Return Value

FixedSizeCollection

at line 130
Generator getIterator()

Returns an iterator over the elements of the collection.

Return Value

Generator

at line 146
Generator|FixedSizeCollection[] iterateCollections()

Returns an iterator over FixedSizeCollections, starting with this and making API calls as required until all of the elements have been retrieved.