BatchRequestTransfer
in package
implements
BatchTransferInterface, BatchDivisorInterface
Batch transfer strategy used to efficiently transfer a batch of requests.
This class is to be used with BatchInterface
Table of Contents
Interfaces
- BatchTransferInterface
- Interface used for transferring batches of items
- BatchDivisorInterface
- Interface used for dividing a queue of items into an array of batches
Properties
- $batchSize : int
Methods
- __construct() : mixed
- Constructor used to specify how large each batch should be
- createBatches() : array<string|int, mixed>|Traversable
- Creates batches of requests by grouping requests by their associated curl multi object.
- transfer() : mixed
- Transfer an array of items
Properties
$batchSize
protected
int
$batchSize
Size of each command batch
Methods
__construct()
Constructor used to specify how large each batch should be
public
__construct([int $batchSize = 50 ]) : mixed
Parameters
- $batchSize : int = 50
-
Size of each batch
createBatches()
Creates batches of requests by grouping requests by their associated curl multi object.
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
transfer()
Transfer an array of items
public
transfer(array<string|int, mixed> $batch) : mixed
Parameters
- $batch : array<string|int, mixed>
-
Array of items to transfer