Open Journal Systems  3.3.0
Guzzle\Service\Resource\ResourceIterator Class Reference
Inheritance diagram for Guzzle\Service\Resource\ResourceIterator:
Guzzle\Common\AbstractHasDispatcher Guzzle\Service\Resource\ResourceIteratorInterface Guzzle\Common\HasDispatcherInterface Guzzle\Common\ToArrayInterface Guzzle\Common\HasDispatcherInterface Guzzle\Tests\Service\Mock\Model\MockCommandIterator

Public Member Functions

 __construct (CommandInterface $command, array $data=array())
 
 count ()
 
 current ()
 
 get ($key)
 
 getNextToken ()
 
 getRequestCount ()
 
 key ()
 
 next ()
 
 rewind ()
 
 set ($key, $value)
 
 setLimit ($limit)
 
 setPageSize ($pageSize)
 
 toArray ()
 
 valid ()
 
- Public Member Functions inherited from Guzzle\Common\AbstractHasDispatcher
 addSubscriber (EventSubscriberInterface $subscriber)
 
 dispatch ($eventName, array $context=array())
 
 getEventDispatcher ()
 
 setEventDispatcher (EventDispatcherInterface $eventDispatcher)
 

Static Public Member Functions

static getAllEvents ()
 

Protected Member Functions

 calculatePageSize ()
 
 resetState ()
 
 sendRequest ()
 

Protected Attributes

 $command
 
 $data = array()
 
 $invalid
 
 $iteratedCount = 0
 
 $limit
 
 $nextToken = false
 
 $originalCommand
 
 $pageSize
 
 $requestCount = 0
 
 $resources
 
 $retrievedCount = 0
 
- Protected Attributes inherited from Guzzle\Common\AbstractHasDispatcher
 $eventDispatcher
 

Detailed Description

Definition at line 8 of file ResourceIterator.php.

Constructor & Destructor Documentation

◆ __construct()

Guzzle\Service\Resource\ResourceIterator::__construct ( CommandInterface  $command,
array  $data = array() 
)
Parameters
CommandInterface$commandInitial command used for iteration
array$dataAssociative 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

Definition at line 93 of file ResourceIterator.php.

References Guzzle\Service\Resource\ResourceIterator\$command, and Guzzle\Service\Resource\ResourceIterator\$data.

Member Function Documentation

◆ calculatePageSize()

Guzzle\Service\Resource\ResourceIterator::calculatePageSize ( )
protected

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

Returns
int Returns the page size of the next request.

Definition at line 260 of file ResourceIterator.php.

References Guzzle\Service\Resource\ResourceIterator\$iteratedCount, and Guzzle\Service\Resource\ResourceIterator\$pageSize.

Referenced by Guzzle\Tests\Service\Mock\Model\MockCommandIterator\sendRequest().

◆ count()

Guzzle\Service\Resource\ResourceIterator::count ( )

◆ current()

Guzzle\Service\Resource\ResourceIterator::current ( )

◆ get()

Guzzle\Service\Resource\ResourceIterator::get (   $key)

Get an option from the iterator

Parameters
string$keyKey of the option to retrieve
Returns
mixed|null Returns NULL if not set or the value if set

Implements Guzzle\Service\Resource\ResourceIteratorInterface.

Definition at line 137 of file ResourceIterator.php.

◆ getAllEvents()

static Guzzle\Service\Resource\ResourceIterator::getAllEvents ( )
static

Get a list of all of the events emitted from the class

Returns
array

Reimplemented from Guzzle\Common\AbstractHasDispatcher.

Definition at line 76 of file ResourceIterator.php.

Referenced by Guzzle\Tests\Service\Resource\ResourceIteratorTest\testDescribesEvents().

◆ getNextToken()

Guzzle\Service\Resource\ResourceIterator::getNextToken ( )

Retrieve the NextToken that can be used in other iterators.

Returns
string Returns a NextToken

Implements Guzzle\Service\Resource\ResourceIteratorInterface.

Definition at line 249 of file ResourceIterator.php.

References Guzzle\Service\Resource\ResourceIterator\$nextToken.

◆ getRequestCount()

Guzzle\Service\Resource\ResourceIterator::getRequestCount ( )

Get the total number of requests sent

Returns
int

Definition at line 177 of file ResourceIterator.php.

References Guzzle\Service\Resource\ResourceIterator\$requestCount.

◆ key()

Guzzle\Service\Resource\ResourceIterator::key ( )

Definition at line 162 of file ResourceIterator.php.

◆ next()

◆ resetState()

Guzzle\Service\Resource\ResourceIterator::resetState ( )
protected

◆ rewind()

Guzzle\Service\Resource\ResourceIterator::rewind ( )

◆ sendRequest()

Guzzle\Service\Resource\ResourceIterator::sendRequest ( )
abstractprotected

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

Returns
array Returns the newly loaded resources

Reimplemented in Guzzle\Tests\Service\Mock\Model\MockCommandIterator.

Referenced by Guzzle\Service\Resource\ResourceIterator\next().

◆ set()

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

Set an option on the iterator

Parameters
string$keyKey of the option to set
mixed$valueValue to set for the option
Returns
ResourceIterator

Implements Guzzle\Service\Resource\ResourceIteratorInterface.

Definition at line 150 of file ResourceIterator.php.

◆ setLimit()

Guzzle\Service\Resource\ResourceIterator::setLimit (   $limit)

Attempt to limit the total number of resources returned by the iterator.

You may still receive more items than you specify. Set to 0 to specify no limit.

Parameters
int$limitLimit amount
Returns
ResourceIteratorInterface

Implements Guzzle\Service\Resource\ResourceIteratorInterface.

Definition at line 114 of file ResourceIterator.php.

References Guzzle\Service\Resource\ResourceIterator\$limit, and Guzzle\Service\Resource\ResourceIterator\resetState().

◆ setPageSize()

Guzzle\Service\Resource\ResourceIterator::setPageSize (   $pageSize)

Attempt to limit the total number of resources retrieved per request by the iterator.

The iterator may return more than you specify in the page size argument depending on the service and underlying command implementation. Set to 0 to specify no page size limitation.

Parameters
int$pageSizeLimit amount
Returns
ResourceIteratorInterface

Implements Guzzle\Service\Resource\ResourceIteratorInterface.

Definition at line 122 of file ResourceIterator.php.

References Guzzle\Service\Resource\ResourceIterator\$pageSize, and Guzzle\Service\Resource\ResourceIterator\resetState().

◆ toArray()

Guzzle\Service\Resource\ResourceIterator::toArray ( )

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

Returns
array

Implements Guzzle\Common\ToArrayInterface.

Definition at line 109 of file ResourceIterator.php.

◆ valid()

Guzzle\Service\Resource\ResourceIterator::valid ( )

Field Documentation

◆ $command

CommandInterface Guzzle\Service\Resource\ResourceIterator::$command
protected

Command used to send requests

Definition at line 14 of file ResourceIterator.php.

Referenced by Guzzle\Service\Resource\ResourceIterator\__construct().

◆ $data

array Guzzle\Service\Resource\ResourceIterator::$data = array()
protected

◆ $invalid

bool Guzzle\Service\Resource\ResourceIterator::$invalid
protected

Whether or not the current value is known to be invalid

Definition at line 74 of file ResourceIterator.php.

◆ $iteratedCount

int Guzzle\Service\Resource\ResourceIterator::$iteratedCount = 0
protected

Total number of resources that have been iterated

Definition at line 38 of file ResourceIterator.php.

Referenced by Guzzle\Service\Resource\ResourceIterator\calculatePageSize(), and Guzzle\Tests\Service\Mock\Model\MockCommandIterator\getIteratedCount().

◆ $limit

int Guzzle\Service\Resource\ResourceIterator::$limit
protected

Maximum number of resources to retrieve in total

Definition at line 56 of file ResourceIterator.php.

Referenced by Guzzle\Service\Resource\ResourceIterator\setLimit().

◆ $nextToken

string Guzzle\Service\Resource\ResourceIterator::$nextToken = false
protected

NextToken/Marker for a subsequent request

Definition at line 44 of file ResourceIterator.php.

Referenced by Guzzle\Service\Resource\ResourceIterator\getNextToken(), and Guzzle\Service\Resource\ResourceIterator\valid().

◆ $originalCommand

CommandInterface Guzzle\Service\Resource\ResourceIterator::$originalCommand
protected

◆ $pageSize

int Guzzle\Service\Resource\ResourceIterator::$pageSize
protected

Maximum number of resources to fetch per request

Definition at line 50 of file ResourceIterator.php.

Referenced by Guzzle\Service\Resource\ResourceIterator\calculatePageSize(), and Guzzle\Service\Resource\ResourceIterator\setPageSize().

◆ $requestCount

int Guzzle\Service\Resource\ResourceIterator::$requestCount = 0
protected

Number of requests sent

Definition at line 62 of file ResourceIterator.php.

Referenced by Guzzle\Service\Resource\ResourceIterator\getRequestCount().

◆ $resources

array Guzzle\Service\Resource\ResourceIterator::$resources
protected

Currently loaded resources

Definition at line 26 of file ResourceIterator.php.

Referenced by Guzzle\Tests\Service\Mock\Model\MockCommandIterator\getResources().

◆ $retrievedCount

int Guzzle\Service\Resource\ResourceIterator::$retrievedCount = 0
protected

Total number of resources that have been retrieved

Definition at line 32 of file ResourceIterator.php.

Referenced by Guzzle\Service\Resource\ResourceIterator\count().


The documentation for this class was generated from the following file: