You are here

public function CurlMultiHandler::__invoke in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php \GuzzleHttp\Handler\CurlMultiHandler::__invoke()

File

vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php, line 61

Class

CurlMultiHandler
Returns an asynchronous response using curl_multi_* functions.

Namespace

GuzzleHttp\Handler

Code

public function __invoke(RequestInterface $request, array $options) {
  $easy = $this->factory
    ->create($request, $options);
  $id = (int) $easy->handle;
  $promise = new Promise([
    $this,
    'execute',
  ], function () use ($id) {
    return $this
      ->cancel($id);
  });
  $this
    ->addRequest([
    'easy' => $easy,
    'deferred' => $promise,
  ]);
  return $promise;
}