36 $groups = new \SplObjectStorage();
37 foreach ($queue as $item) {
41 $client = $item->getClient();
42 if (!$groups->contains($client)) {
43 $groups->attach($client, array($item));
45 $current = $groups[$client];
47 $groups[$client] = $current;
52 foreach ($groups as $batch) {
53 $batches = array_merge($batches, array_chunk($groups[$batch], $this->batchSize));
59 public function transfer(array $batch)
62 reset($batch)->getClient()->send($batch);