BatchCommandTransfer
in package
implements
BatchTransferInterface, BatchDivisorInterface
Efficiently transfers multiple commands in parallel per client This class is to be used with {@see Guzzle\Batch\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
- createBatches() : array<string|int, mixed>|Traversable
- Creates batches by grouping commands by their associated client {@inheritdoc}
- transfer() : mixed
- Transfer an array of items
Properties
$batchSize
protected
int
$batchSize
Size of each command batch
Methods
__construct()
public
__construct([int $batchSize = 50 ]) : mixed
Parameters
- $batchSize : int = 50
-
Size of each batch
createBatches()
Creates batches by grouping commands by their associated client {@inheritdoc}
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