Class Guzzle\Batch\BatchBuilder

InheritanceGuzzle\Batch\BatchBuilder

Builder used to create custom batch objects

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$afterFlush mixed Callable to invoke each time a flush completes Guzzle\Batch\BatchBuilder
$autoFlush bool Whether or not the batch should automatically flush Guzzle\Batch\BatchBuilder
$divisorStrategy Guzzle\Batch\BatchDivisorInterface Object used to divide the queue into batches Guzzle\Batch\BatchBuilder
$exceptionBuffering bool Whether or not to buffer exceptions encountered in transfer Guzzle\Batch\BatchBuilder
$history bool Whether or not to maintain a batch history Guzzle\Batch\BatchBuilder
$mapping array Of Mapped transfer strategies by handle name Guzzle\Batch\BatchBuilder
$transferStrategy Guzzle\Batch\BatchTransferInterface Object used to transfer items in the queue Guzzle\Batch\BatchBuilder

Public Methods

Hide inherited methods

MethodDescriptionDefined By
autoFlushAt() Automatically flush the batch when the size of the queue reaches a certain threshold. Adds {@see FlushingBatch}. Guzzle\Batch\BatchBuilder
bufferExceptions() Buffer exceptions thrown during transfer so that you can transfer as much as possible, and after a transfer completes, inspect each exception that was thrown. Enables the {@see ExceptionBufferingBatch} decorator. Guzzle\Batch\BatchBuilder
build() Create and return the instantiated batch Guzzle\Batch\BatchBuilder
createBatchesWith() Specify the strategy used to divide the queue into an array of batches Guzzle\Batch\BatchBuilder
factory() Create a new instance of the BatchBuilder Guzzle\Batch\BatchBuilder
keepHistory() Maintain a history of all items that have been transferred using the batch. Adds {@see HistoryBatch}. Guzzle\Batch\BatchBuilder
notify() Notify a callable each time a batch flush completes. Enables the {@see NotifyingBatch} decorator. Guzzle\Batch\BatchBuilder
transferCommands() Configures the batch to transfer batches commands. Associates as {@see \Guzzle\Service\Command\BatchCommandTransfer} as both the transfer and divisor strategy. Guzzle\Batch\BatchBuilder
transferRequests() Configures the batch to transfer batches of requests. Associates a {@see \Guzzle\Http\BatchRequestTransfer} object as both the transfer and divisor strategy. Guzzle\Batch\BatchBuilder
transferWith() Specify the strategy used to transport the items when flush is called Guzzle\Batch\BatchBuilder

Property Details

$afterFlush protected property

Callable to invoke each time a flush completes

protected mixed $afterFlush null
$autoFlush protected property

Whether or not the batch should automatically flush

protected bool $autoFlush false
$divisorStrategy protected property

Object used to divide the queue into batches

$exceptionBuffering protected property

Whether or not to buffer exceptions encountered in transfer

protected bool $exceptionBuffering false
$history protected property

Whether or not to maintain a batch history

protected bool $history false
$mapping protected static property

Of Mapped transfer strategies by handle name

protected static array $mapping = ['request' => 'Guzzle\Batch\BatchRequestTransfer''command' => 'Guzzle\Batch\BatchCommandTransfer']
$transferStrategy protected property

Object used to transfer items in the queue

Method Details

autoFlushAt() public method

Automatically flush the batch when the size of the queue reaches a certain threshold. Adds {@see FlushingBatch}.

public Guzzle\Batch\BatchBuilder autoFlushAt ( $threshold )
$threshold

Number of items to allow in the queue before a flush

bufferExceptions() public method

Buffer exceptions thrown during transfer so that you can transfer as much as possible, and after a transfer completes, inspect each exception that was thrown. Enables the {@see ExceptionBufferingBatch} decorator.

public Guzzle\Batch\BatchBuilder bufferExceptions ( )
build() public method

Create and return the instantiated batch

public Guzzle\Batch\BatchInterface build ( )
throws Guzzle\Common\Exception\RuntimeException

if no transfer strategy has been specified

createBatchesWith() public method

Specify the strategy used to divide the queue into an array of batches

public Guzzle\Batch\BatchBuilder createBatchesWith ( Guzzle\Batch\BatchDivisorInterface $divisorStrategy )
$divisorStrategy Guzzle\Batch\BatchDivisorInterface

Strategy used to divide a batch queue into batches

factory() public static method

Create a new instance of the BatchBuilder

public static Guzzle\Batch\BatchBuilder factory ( )
keepHistory() public method

Maintain a history of all items that have been transferred using the batch. Adds {@see HistoryBatch}.

public Guzzle\Batch\BatchBuilder keepHistory ( )
notify() public method

Notify a callable each time a batch flush completes. Enables the {@see NotifyingBatch} decorator.

public Guzzle\Batch\BatchBuilder notify ( $callable )
$callable mixed

Callable function to notify

throws Guzzle\Common\Exception\InvalidArgumentException

if the argument is not callable

transferCommands() public method

Configures the batch to transfer batches commands. Associates as {@see \Guzzle\Service\Command\BatchCommandTransfer} as both the transfer and divisor strategy.

public Guzzle\Batch\BatchBuilder transferCommands ( $batchSize 50 )
$batchSize int

Batch size for each batch of commands

transferRequests() public method

Configures the batch to transfer batches of requests. Associates a {@see \Guzzle\Http\BatchRequestTransfer} object as both the transfer and divisor strategy.

public Guzzle\Batch\BatchBuilder transferRequests ( $batchSize 50 )
$batchSize int

Batch size for each batch of requests

transferWith() public method

Specify the strategy used to transport the items when flush is called

public Guzzle\Batch\BatchBuilder transferWith ( Guzzle\Batch\BatchTransferInterface $transferStrategy )
$transferStrategy Guzzle\Batch\BatchTransferInterface

How items are transferred