Class Guzzle\Batch\Batch


Default batch implementation used to convert queued items into smaller chunks of batches using a {@see BatchDivisorIterface} and transfers each batch using a {@see BatchTransferInterface}.

Any exception encountered during a flush operation will throw a {@see BatchTransferException} object containing the batch that failed. After an exception is encountered, you can flush the batch again to attempt to finish transferring any previously created batches or queued items.

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
createBatches() Create batches for any queued items Guzzle\Batch\Batch

Property Details

$dividedBatches protected property

Divided batches to be transferred

protected array $dividedBatches null
$divisionStrategy protected property
$queue protected property

Queue of items in the queue

protected SplQueue $queue null
$transferStrategy protected property

Method Details

__construct() public method

public void __construct ( Guzzle\Batch\BatchTransferInterface $transferStrategy, Guzzle\Batch\BatchDivisorInterface $divisionStrategy )
$transferStrategy Guzzle\Batch\BatchTransferInterface

Strategy used to transfer items

$divisionStrategy Guzzle\Batch\BatchDivisorInterface

Divisor used to create batches

add() public method

public void add ( $item )
createBatches() protected method

Create batches for any queued items

protected void createBatches ( )
flush() public method

public void flush ( )
isEmpty() public method

public void isEmpty ( )