Abstract Class Guzzle\Service\Resource\ResourceIterator

InheritanceGuzzle\Service\Resource\ResourceIterator » Guzzle\Common\AbstractHasDispatcher
ImplementsGuzzle\Common\HasDispatcherInterface, Guzzle\Service\Resource\ResourceIteratorInterface

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$command Guzzle\Service\Command\CommandInterface Command used to send requests Guzzle\Service\Resource\ResourceIterator
$data array Initial data passed to the constructor Guzzle\Service\Resource\ResourceIterator
$eventDispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface Guzzle\Common\AbstractHasDispatcher
$invalid bool Whether or not the current value is known to be invalid Guzzle\Service\Resource\ResourceIterator
$iteratedCount int Total number of resources that have been iterated Guzzle\Service\Resource\ResourceIterator
$limit int Maximum number of resources to retrieve in total Guzzle\Service\Resource\ResourceIterator
$nextToken string NextToken/Marker for a subsequent request Guzzle\Service\Resource\ResourceIterator
$originalCommand Guzzle\Service\Command\CommandInterface First sent command Guzzle\Service\Resource\ResourceIterator
$pageSize int Maximum number of resources to fetch per request Guzzle\Service\Resource\ResourceIterator
$requestCount int Number of requests sent Guzzle\Service\Resource\ResourceIterator
$resources array Currently loaded resources Guzzle\Service\Resource\ResourceIterator
$retrievedCount int Total number of resources that have been retrieved Guzzle\Service\Resource\ResourceIterator

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Guzzle\Service\Resource\ResourceIterator
addSubscriber() Add an event subscriber to the dispatcher Guzzle\Common\HasDispatcherInterface
count() Guzzle\Service\Resource\ResourceIterator
current() Guzzle\Service\Resource\ResourceIterator
dispatch() Helper to dispatch Guzzle events and set the event name on the event Guzzle\Common\HasDispatcherInterface
get() Get an option from the iterator Guzzle\Service\Resource\ResourceIterator
getAllEvents() Guzzle\Service\Resource\ResourceIterator
getEventDispatcher() Get the EventDispatcher of the request Guzzle\Common\HasDispatcherInterface
getNextToken() Retrieve the NextToken that can be used in other iterators. Guzzle\Service\Resource\ResourceIterator
getRequestCount() Get the total number of requests sent Guzzle\Service\Resource\ResourceIterator
key() Guzzle\Service\Resource\ResourceIterator
next() Guzzle\Service\Resource\ResourceIterator
rewind() Rewind the Iterator to the first element and send the original command Guzzle\Service\Resource\ResourceIterator
set() Set an option on the iterator Guzzle\Service\Resource\ResourceIterator
setEventDispatcher() Set the EventDispatcher of the request Guzzle\Common\HasDispatcherInterface
setLimit() Guzzle\Service\Resource\ResourceIterator
setPageSize() Guzzle\Service\Resource\ResourceIterator
toArray() Get all of the resources as an array (Warning: this could issue a large number of requests) Guzzle\Service\Resource\ResourceIterator
valid() Guzzle\Service\Resource\ResourceIterator

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
calculatePageSize() Returns the value that should be specified for the page size for a request that will maintain any hard limits, but still honor the specified pageSize if the number of items retrieved + pageSize < hard limit Guzzle\Service\Resource\ResourceIterator
resetState() Reset the internal state of the iterator without triggering a rewind() Guzzle\Service\Resource\ResourceIterator
sendRequest() Send a request to retrieve the next page of results. Hook for subclasses to implement. Guzzle\Service\Resource\ResourceIterator

Property Details

$command protected property

Command used to send requests

$data protected property

Initial data passed to the constructor

protected array $data = []
$invalid protected property

Whether or not the current value is known to be invalid

protected bool $invalid null
$iteratedCount protected property

Total number of resources that have been iterated

protected int $iteratedCount 0
$limit protected property

Maximum number of resources to retrieve in total

protected int $limit null
$nextToken protected property

NextToken/Marker for a subsequent request

protected string $nextToken false
$originalCommand protected property

First sent command

$pageSize protected property

Maximum number of resources to fetch per request

protected int $pageSize null
$requestCount protected property

Number of requests sent

protected int $requestCount 0
$resources protected property

Currently loaded resources

protected array $resources null
$retrievedCount protected property

Total number of resources that have been retrieved

protected int $retrievedCount 0

Method Details

__construct() public method

public void __construct ( Guzzle\Service\Command\CommandInterface $command, array $data = [] )
$command Guzzle\Service\Command\CommandInterface

Initial command used for iteration

$data array

Associative array of additional parameters. You may specify any number of custom

options for an iterator. Among these options, you may also specify the following values:
- limit: Attempt to limit the maximum number of resources to this amount
- page_size: Attempt to retrieve this number of resources per request
calculatePageSize() protected method

Returns the value that should be specified for the page size for a request that will maintain any hard limits, but still honor the specified pageSize if the number of items retrieved + pageSize < hard limit

protected int calculatePageSize ( )
return int

Returns the page size of the next request.

count() public method

public void count ( )
current() public method

public void current ( )
get() public method

Get an option from the iterator

public mixed|null get ( $key )
$key string

Key of the option to retrieve

return mixed|null

Returns NULL if not set or the value if set

getAllEvents() public static method

public static void getAllEvents ( )
getNextToken() public method

Retrieve the NextToken that can be used in other iterators.

public string getNextToken ( )
return string

Returns a NextToken

getRequestCount() public method

Get the total number of requests sent

public int getRequestCount ( )
key() public method

public void key ( )
next() public method

public void next ( )
resetState() protected method

Reset the internal state of the iterator without triggering a rewind()

protected void resetState ( )
rewind() public method

Rewind the Iterator to the first element and send the original command

public void rewind ( )
sendRequest() protected abstract method

Send a request to retrieve the next page of results. Hook for subclasses to implement.

protected abstract array sendRequest ( )
return array

Returns the newly loaded resources

set() public method

Set an option on the iterator

public Guzzle\Service\Resource\ResourceIterator set ( $key, $value )
$key string

Key of the option to set

$value mixed

Value to set for the option

setLimit() public method

public void setLimit ( $limit )
$limit
setPageSize() public method

public void setPageSize ( $pageSize )
$pageSize
toArray() public method

Get all of the resources as an array (Warning: this could issue a large number of requests)

public array toArray ( )
valid() public method

public void valid ( )