protected function CurlMulti::buildMultiTransferException

Build a MultiTransferException if needed

Parameters

array $requestsInScope All requests in the previous scope:

Return value

MultiTransferException|null

1 call to CurlMulti::buildMultiTransferException()

File

drupal/core/vendor/guzzle/http/Guzzle/Http/Curl/CurlMulti.php, line 317

Class

CurlMulti
Send { This implementation allows callers to send blocking requests that return back to the caller when their requests complete, regardless of whether or not previously sending requests in the curl_multi object have completed. The implementation…

Namespace

Guzzle\Http\Curl

Code

protected function buildMultiTransferException(array $requestsInScope) {
  if (empty($this->exceptions)) {
    return null;
  }

  // Keep a list of all requests, and remove errored requests from the list
  $store = new \SplObjectStorage();
  foreach ($requestsInScope as $request) {
    $store
      ->attach($request);
  }
  $multiException = new MultiTransferException('Errors during multi transfer');
  while ($e = array_shift($this->exceptions)) {
    $multiException
      ->add($e['exception']);
    if (isset($e['request'])) {
      $multiException
        ->addFailedRequest($e['request']);

      // Remove from the total list so that it becomes a list of successful requests
      unset($store[$e['request']]);
    }
  }

  // Add successful requests
  foreach ($store as $request) {
    $multiException
      ->addSuccessfulRequest($request);
  }
  return $multiException;
}