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

Public Member Functions

 __construct ($callable, $context=null)
 
 createBatches (\SplQueue $queue)
 

Protected Attributes

 $callable
 
 $context
 

Detailed Description

Divides batches using a callable

Definition at line 10 of file BatchClosureDivisor.php.

Constructor & Destructor Documentation

◆ __construct()

Guzzle\Batch\BatchClosureDivisor::__construct (   $callable,
  $context = null 
)
Parameters
callable$callableMethod used to divide the batches. The method must accept an \SplQueue and return an array of arrays containing the divided items.
mixed$contextOptional context to pass to the batch divisor
Exceptions
InvalidArgumentExceptionif the callable is not callable

Definition at line 31 of file BatchClosureDivisor.php.

References Guzzle\Batch\BatchClosureDivisor\$callable, and Guzzle\Batch\BatchClosureDivisor\$context.

Member Function Documentation

◆ createBatches()

Guzzle\Batch\BatchClosureDivisor::createBatches ( \SplQueue  $queue)

Divide a queue of items into an array batches

Parameters
\SplQueue$queueQueue of items to divide into batches. Items are removed as they are iterated.
Returns
array|\Traversable Returns an array or Traversable object that contains arrays of items to transfer

Implements Guzzle\Batch\BatchDivisorInterface.

Definition at line 41 of file BatchClosureDivisor.php.

Referenced by Guzzle\Tests\Batch\BatchClosureDivisorTest\testDividesBatch().

Field Documentation

◆ $callable

callable Guzzle\Batch\BatchClosureDivisor::$callable
protected

Method used to divide the batches

Definition at line 16 of file BatchClosureDivisor.php.

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

◆ $context

mixed Guzzle\Batch\BatchClosureDivisor::$context
protected

$context Context passed to the callable

Definition at line 22 of file BatchClosureDivisor.php.

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


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