/**
  * @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 testDelegate()
 {
     $handlerBuilder = $this->getMockBuilder('goreilly\\WebConnector\\HandlerInterface');
     $itemHandler = $handlerBuilder->getMock();
     $itemHandler->expects($this->once())->method('supports')->willReturnCallback(function ($name) {
         return $name === 'ItemQueryRs';
     });
     $itemHandler->expects($this->once())->method('handle');
     $handlers = [$itemHandler];
     $delegator = new ResponseDelegator($handlers);
     $response = $this->getResponse();
     $delegator->delegate($response);
 }