BatchSizeDivisor
in package
implements
BatchDivisorInterface
Divides batches into smaller batches under a certain size
Table of Contents
Interfaces
- BatchDivisorInterface
- Interface used for dividing a queue of items into an array of batches
Properties
- $size : int
Methods
- __construct() : mixed
- createBatches() : array<string|int, mixed>|Traversable
- Divide a queue of items into an array batches
- getSize() : int
- Get the size of each batch
- setSize() : BatchSizeDivisor
- Set the size of each batch
Properties
$size
protected
int
$size
Size of each batch
Methods
__construct()
public
__construct(int $size) : mixed
Parameters
- $size : int
-
Size of each batch
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
getSize()
Get the size of each batch
public
getSize() : int
Return values
intsetSize()
Set the size of each batch
public
setSize(int $size) : BatchSizeDivisor
Parameters
- $size : int
-
Size of each batch