Class Batch
Default batch implementation used to convert queued items into smaller chunks
of batches using a BatchDivisorIterface and transfers each batch using a
Guzzle\Batch\BatchTransferInterface
.
Any exception encountered during a flush operation will throw a Guzzle\Batch\Exception\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.
- Guzzle\Batch\Batch implements Guzzle\Batch\BatchInterface
Methods summary
-
public
__construct ( Guzzle\Batch\BatchTransferInterface $transferStrategy, Guzzle\Batch\BatchDivisorInterface $divisionStrategy )
-
public
add ( mixed $item )
Add an item to the queue
-
public
flush ( )
Flush the batch and transfer the items
-
public
isEmpty ( )
Check if the batch is empty and has further items to transfer
-
protected
createBatches ( )
Create batches for any queued items
Methods detail
public
__construct( Guzzle\Batch\BatchTransferInterface
$transferStrategy, Guzzle\Batch\BatchDivisorInterface
$divisionStrategy )
Parameters
- $transferStrategy
Guzzle\Batch\BatchTransferInterface
$transferStrategy Strategy used to transfer items- $divisionStrategy
Guzzle\Batch\BatchDivisorInterface
$divisionStrategy Divisor used to create batches
Add an item to the queue
Parameters
- $item
mixed
$item Item to add
Returns
Implementation of
Flush the batch and transfer the items
Returns
array
Returns an array flushed items
Implementation of
Check if the batch is empty and has further items to transfer
Returns
boolean
Implementation of
Create batches for any queued items
Magic methods summary
Properties summary
protected
|
$queue |
#
Queue of items in the queue |
protected
array
|
$dividedBatches |
#
Divided batches to be transferred |
protected
|
$transferStrategy | |
protected
|
$divisionStrategy |