You are here

public static function Proxy::wrapSync in Zircon Profile 8.0

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

Sends synchronous requests to a specific handler while sending all other requests to another handler.

Parameters

callable $default Handler used for normal responses:

callable $sync Handler used for synchronous responses.:

Return value

callable Returns the composed handler.

1 call to Proxy::wrapSync()
choose_handler in vendor/guzzlehttp/guzzle/src/functions.php
Chooses and creates a default handler to use based on the environment.

File

vendor/guzzlehttp/guzzle/src/Handler/Proxy.php, line 20

Class

Proxy
Provides basic proxies for handlers.

Namespace

GuzzleHttp\Handler

Code

public static function wrapSync(callable $default, callable $sync) {
  return function (RequestInterface $request, array $options) use ($default, $sync) {
    return empty($options['sync']) ? $default($request, $options) : $sync($request, $options);
  };
}