You are here

public function HandlerStack::resolve in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/guzzlehttp/guzzle/src/HandlerStack.php \GuzzleHttp\HandlerStack::resolve()

Compose the middleware and handler into a single callable function.

Return value

callable

1 call to HandlerStack::resolve()
HandlerStack::__invoke in vendor/guzzlehttp/guzzle/src/HandlerStack.php
Invokes the handler stack as a composed handler

File

vendor/guzzlehttp/guzzle/src/HandlerStack.php, line 194

Class

HandlerStack
Creates a composed Guzzle handler function by stacking middlewares on top of an HTTP handler function.

Namespace

GuzzleHttp

Code

public function resolve() {
  if (!($prev = $this->handler)) {
    throw new \LogicException('No handler has been specified');
  }
  foreach (array_reverse($this->stack) as $fn) {
    $prev = $fn[0]($prev);
  }
  return $prev;
}