Documentation

BatchClosureDivisor
in package
implements BatchDivisorInterface

Divides batches using a callable

Table of Contents

Interfaces

BatchDivisorInterface
Interface used for dividing a queue of items into an array of batches

Properties

$callable  : callable
$context  : mixed

Methods

__construct()  : mixed
createBatches()  : array<string|int, mixed>|Traversable
Divide a queue of items into an array batches

Properties

Methods

__construct()

public __construct(callable $callable[, mixed $context = null ]) : mixed
Parameters
$callable : callable

Method used to divide the batches. The method must accept an \SplQueue and return an array of arrays containing the divided items.

$context : mixed = null

Optional context to pass to the batch divisor

Tags
throws
InvalidArgumentException

if the callable is not callable

createBatches()

Divide a queue of items into an array batches

public createBatches(SplQueue $queue) : array<string|int, mixed>|Traversable
Parameters
$queue : SplQueue

Queue of items to divide into batches. Items are removed as they are iterated.

Return values
array<string|int, mixed>|Traversable

Returns an array or Traversable object that contains arrays of items to transfer


        
On this page

Search results