/** * @param mixed[] $argv * @return mixed */ public function handle(array $argv) { $this->delegator->delegate($argv[0]); $total = $this->queue->getMax(); $remaining = $this->queue->count(); if ($total && $remaining) { $progress = round(($total - $remaining) / $total * 100); } else { $progress = 100; } $response = new ReceiveResponseXMLResponse(); $response->receiveResponseXMLResult = $progress; return $response; }
public function testGetMax() { $queue = new TaskQueue(); $task = $this->getTask(); $max = 10; for ($i = 0; $i < $max; $i++) { $queue->add($task); } $queue->pop(); $queue->pop(); $queue->pop(); $queue->pop(); $this->assertEquals($max, $queue->getMax()); }