/**
  * On multi request created event.
  *
  * @param \Ivory\HttpAdapter\Event\MultiRequestCreatedEvent $event The multi request created event.
  */
 public function onMultiRequestCreated(MultiRequestCreatedEvent $event)
 {
     foreach ($event->getRequests() as $request) {
         $event->removeRequest($request);
         $event->addRequest($this->cookieJar->populate($request));
     }
 }
 /**
  * On multi request created event.
  *
  * @param \Ivory\HttpAdapter\Event\MultiRequestCreatedEvent $event The multi request created event.
  */
 public function onMultiRequestCreated(MultiRequestCreatedEvent $event)
 {
     foreach ($event->getRequests() as $request) {
         $event->removeRequest($request);
         $event->addRequest($this->basicAuth->authenticate($request));
     }
 }
 /**
  * On multi request created event.
  *
  * @param \Ivory\HttpAdapter\Event\MultiRequestCreatedEvent $event The multi request created event.
  */
 public function onMultiRequestCreated(MultiRequestCreatedEvent $event)
 {
     foreach ($event->getRequests() as $request) {
         $event->removeRequest($request);
         $event->addRequest($this->getTimer()->start($request));
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function doSendInternalRequests(array $internalRequests)
 {
     if (!empty($internalRequests)) {
         $this->eventDispatcher->dispatch(Events::MULTI_REQUEST_CREATED, $multiRequestCreatedEvent = new MultiRequestCreatedEvent($this, $internalRequests));
         $internalRequests = $multiRequestCreatedEvent->getRequests();
     }
     $exceptions = array();
     try {
         $responses = parent::doSendInternalRequests($internalRequests);
     } catch (MultiHttpAdapterException $e) {
         $responses = $e->getResponses();
         $exceptions = $e->getExceptions();
     }
     if (!empty($responses)) {
         $this->eventDispatcher->dispatch(Events::MULTI_REQUEST_SENT, $requestSentEvent = new MultiRequestSentEvent($this, $responses));
         $exceptions = array_merge($exceptions, $requestSentEvent->getExceptions());
         $responses = $requestSentEvent->getResponses();
     }
     if (!empty($exceptions)) {
         $this->eventDispatcher->dispatch(Events::MULTI_REQUEST_ERRORED, $exceptionEvent = new MultiRequestErroredEvent($this, $exceptions));
         $responses = array_merge($responses, $exceptionEvent->getResponses());
         $exceptions = $exceptionEvent->getExceptions();
         if (!empty($exceptions)) {
             throw new MultiHttpAdapterException($exceptions, $responses);
         }
     }
     return $responses;
 }
 /**
  * On multi request created event.
  *
  * @param \Ivory\HttpAdapter\Event\MultiRequestCreatedEvent $event The multi request created event.
  */
 public function onMultiRequestCreated(MultiRequestCreatedEvent $event)
 {
     foreach ($event->getRequests() as $request) {
         $this->stopwatch->start($this->getStopwatchName($event->getHttpAdapter(), $request));
     }
 }