/**
  * @param mixed[] $argv
  * @return mixed
  * @throws \Exception
  */
 public function handle(array $argv)
 {
     $response = new SendRequestXMLResponse();
     $task = $this->queue->pop();
     if (!$task) {
         return $response;
     }
     $root = $this->xmlFactory->createQBXML();
     $task->getRequest()->appendElementTo($root);
     $response->sendRequestXMLResult = $root->asXML();
     return $response;
 }
 /**
  * @param mixed[] $argv
  * @return mixed
  * @see http://wiki.consolibyte.com/wiki/doku.php/quickbooks_web_connector
  */
 public function handle(array $argv)
 {
     $request = $this->mapRequest($argv);
     $ticket = $this->authenticator->getTicket($request->strUserName, $request->strPassword);
     $alert = 'nvu';
     // Not Valid User
     $taskCount = 0;
     if ($ticket) {
         foreach ($this->tasks as $task) {
             if ($task->shouldRun()) {
                 $this->queue->add($task);
             }
         }
         $taskCount = $this->queue->count();
         $alert = '';
         // Something to do
         if ($taskCount === 0) {
             $alert = 'none';
             // Nothing to do
         }
     }
     // If there is something to do, send 4 elements.
     return new AuthenticateResponse(array_pad([$ticket, $alert], $taskCount > 0 ? 4 : 2, ''));
 }