You are here

public function CurlMultiHandler::__invoke in Lockr 7.3

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;
}