Open Monograph Press  3.3.0
Proxy.php
1 <?php
2 namespace GuzzleHttp\Handler;
3 
6 
10 class Proxy
11 {
21  public static function wrapSync(
22  callable $default,
23  callable $sync
24  ) {
25  return function (RequestInterface $request, array $options) use ($default, $sync) {
26  return empty($options[RequestOptions::SYNCHRONOUS])
27  ? $default($request, $options)
28  : $sync($request, $options);
29  };
30  }
31 
45  public static function wrapStreaming(
46  callable $default,
47  callable $streaming
48  ) {
49  return function (RequestInterface $request, array $options) use ($default, $streaming) {
50  return empty($options['stream'])
51  ? $default($request, $options)
52  : $streaming($request, $options);
53  };
54  }
55 }
Psr\Http\Message\RequestInterface
Definition: vendor/psr/http-message/src/RequestInterface.php:24
GuzzleHttp\Handler\Proxy\wrapStreaming
static wrapStreaming(callable $default, callable $streaming)
Definition: Proxy.php:45
GuzzleHttp\Handler
Definition: CurlFactory.php:2
GuzzleHttp\Handler\Proxy\wrapSync
static wrapSync(callable $default, callable $sync)
Definition: Proxy.php:21
GuzzleHttp\RequestOptions
Definition: RequestOptions.php:11
GuzzleHttp\RequestOptions\SYNCHRONOUS
const SYNCHRONOUS
Definition: RequestOptions.php:216
GuzzleHttp\Handler\Proxy
Definition: Proxy.php:10