public function executeTasks(Queue $queue) { if ($queue->count() === 0) { throw new Exception('Task queue can not be empty'); } $manager = new ThreadsManager($this->getNumberOfThreads()); $manager->executeLoop($queue); return true; }
protected function addThreadToLoop(curlThread $thread, Queue $queue) { if ($queue->count() > 0 && ($task = $queue->dequeue())) { $thread->setTask($task); $thread->applyCurlOptions(); $this->multiCurl->addThread($thread); return true; } return false; }