Open Journal Systems  3.3.0
Guzzle\Batch\Batch Class Reference
Inheritance diagram for Guzzle\Batch\Batch:
Guzzle\Batch\BatchInterface

Public Member Functions

 __construct (BatchTransferInterface $transferStrategy, BatchDivisorInterface $divisionStrategy)
 
 add ($item)
 
 flush ()
 
 isEmpty ()
 

Protected Member Functions

 createBatches ()
 

Protected Attributes

 $dividedBatches
 
 $divisionStrategy
 
 $queue
 
 $transferStrategy
 

Detailed Description

Default batch implementation used to convert queued items into smaller chunks of batches using a {

See also
BatchDivisorIterface} and transfers each batch using a {
BatchTransferInterface}.

Any exception encountered during a flush operation will throw a {

See also
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.

Definition at line 15 of file Batch.php.

Constructor & Destructor Documentation

◆ __construct()

Guzzle\Batch\Batch::__construct ( BatchTransferInterface  $transferStrategy,
BatchDivisorInterface  $divisionStrategy 
)
Parameters
BatchTransferInterface$transferStrategyStrategy used to transfer items
BatchDivisorInterface$divisionStrategyDivisor used to create batches

Definition at line 45 of file Batch.php.

References Guzzle\Batch\Batch\$divisionStrategy, and Guzzle\Batch\Batch\$transferStrategy.

Member Function Documentation

◆ add()

Guzzle\Batch\Batch::add (   $item)

Add an item to the queue

Parameters
mixed$itemItem to add
Returns
self

Implements Guzzle\Batch\BatchInterface.

Definition at line 54 of file Batch.php.

◆ createBatches()

Guzzle\Batch\Batch::createBatches ( )
protected

Create batches for any queued items

Definition at line 92 of file Batch.php.

Referenced by Guzzle\Batch\Batch\flush().

◆ flush()

Guzzle\Batch\Batch::flush ( )

Flush the batch and transfer the items

Returns
array Returns an array flushed items

Implements Guzzle\Batch\BatchInterface.

Definition at line 61 of file Batch.php.

References Guzzle\Batch\Batch\createBatches().

◆ isEmpty()

Guzzle\Batch\Batch::isEmpty ( )

Check if the batch is empty and has further items to transfer

Returns
bool

Implements Guzzle\Batch\BatchInterface.

Definition at line 84 of file Batch.php.

Field Documentation

◆ $dividedBatches

array Guzzle\Batch\Batch::$dividedBatches
protected

Divided batches to be transferred

Definition at line 27 of file Batch.php.

◆ $divisionStrategy

BatchDivisorInterface Guzzle\Batch\Batch::$divisionStrategy
protected

Definition at line 39 of file Batch.php.

Referenced by Guzzle\Batch\Batch\__construct().

◆ $queue

SplQueue Guzzle\Batch\Batch::$queue
protected

Queue of items in the queue

Definition at line 21 of file Batch.php.

◆ $transferStrategy

BatchTransferInterface Guzzle\Batch\Batch::$transferStrategy
protected

Definition at line 33 of file Batch.php.

Referenced by Guzzle\Batch\Batch\__construct().


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