Copied!

A Page object wraps an API list method response and provides methods to retrieve additional pages using the page token.

CloneableInstantiableIterable
Constants
public Google\ApiCore\Page::FINAL_PAGE_TOKEN = ''
Methods
public __construct(Google\ApiCore\Call $call, array $options, callable $callable, Google\ApiCore\PageStreamingDescriptor $pageStreamingDescriptor, Google\Protobuf\Internal\Message $response)
 

Page constructor.

  • param \Call $call
  • param array $options
  • param callable $callable
  • param \PageStreamingDescriptor $pageStreamingDescriptor
  • param \Message $response
public expandToFixedSizeCollection( $collectionSize)
 

Returns a collection of elements with a fixed size set by the collectionSize parameter. The collection will only contain fewer than collectionSize elements if there are no more pages to be retrieved from the server.

NOTE: it is an error to call this method if an optional parameter to set the page size is not supported or has not been set in the API call that was used to create this page. It is also an error if the collectionSize parameter is less than the page size that has been set.

  • param int $collectionSize
  • throws \ValidationException if a FixedSizeCollection of the specified size cannot be constructed
  • return \FixedSizeCollection
public getIterator()
 

Return an iterator over the elements in the response.

  • return \Generator
  • attribute ReturnTypeWillChange
public getNextPage(?int $pageSize = NULL)
 

Retrieves the next Page object using the next page token.

  • param int|null $pageSize
  • throws \ValidationException if there are no pages remaining, or if pageSize is supplied but is not supported by the API
  • throws \ApiException if the call to fetch the next page fails.
  • return \Page
public getNextPageToken()
 

Returns the next page token from the response.

  • return string
public getPageElementCount()
 

Return the number of elements in the response.

  • return int
public getRequestObject()
 

Gets the request object used to generate the Page.

  • return mixed|\Message
public getResponseObject()
 

Gets the API response object.

  • return mixed|\Message
public hasNextPage()
 

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

  • return bool
public iteratePages()
 

Return an iterator over Page objects, beginning with this object.

Additional Page objects are retrieved lazily via API calls until all elements have been retrieved.

  • return \Generator|\Page[]
  • throws \ValidationException
  • throws \ApiException
Properties
private $call = NULL
private $callable = NULL
private $options = NULL
private $pageStreamingDescriptor = NULL
private $pageToken = NULL
private $response = NULL
© 2025 Bruce Wells
Search Namespaces \ Classes
Configuration