PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.6
Booking for Appointments and Events Calendar – Amelia v2.4.6
2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / guzzlehttp / guzzle / src / Handler / Proxy.php
ameliabooking / vendor / guzzlehttp / guzzle / src / Handler Last commit date
CurlFactory.php 7 months ago CurlFactoryInterface.php 7 months ago CurlHandler.php 7 months ago CurlMultiHandler.php 7 months ago EasyHandle.php 7 months ago HeaderProcessor.php 7 months ago MockHandler.php 7 months ago Proxy.php 7 months ago StreamHandler.php 7 months ago
Proxy.php
52 lines
1 <?php
2
3 namespace AmeliaVendor\GuzzleHttp\Handler;
4
5 use AmeliaVendor\GuzzleHttp\Promise\PromiseInterface;
6 use AmeliaVendor\GuzzleHttp\RequestOptions;
7 use AmeliaVendor\Psr\Http\Message\RequestInterface;
8
9 /**
10 * Provides basic proxies for handlers.
11 *
12 * @final
13 */
14 class Proxy
15 {
16 /**
17 * Sends synchronous requests to a specific handler while sending all other
18 * requests to another handler.
19 *
20 * @param callable(RequestInterface, array): PromiseInterface $default Handler used for normal responses
21 * @param callable(RequestInterface, array): PromiseInterface $sync Handler used for synchronous responses.
22 *
23 * @return callable(RequestInterface, array): PromiseInterface Returns the composed handler.
24 */
25 public static function wrapSync(callable $default, callable $sync): callable
26 {
27 return static function (RequestInterface $request, array $options) use ($default, $sync): PromiseInterface {
28 return empty($options[RequestOptions::SYNCHRONOUS]) ? $default($request, $options) : $sync($request, $options);
29 };
30 }
31
32 /**
33 * Sends streaming requests to a streaming compatible handler while sending
34 * all other requests to a default handler.
35 *
36 * This, for example, could be useful for taking advantage of the
37 * performance benefits of curl while still supporting true streaming
38 * through the StreamHandler.
39 *
40 * @param callable(RequestInterface, array): PromiseInterface $default Handler used for non-streaming responses
41 * @param callable(RequestInterface, array): PromiseInterface $streaming Handler used for streaming responses
42 *
43 * @return callable(RequestInterface, array): PromiseInterface Returns the composed handler.
44 */
45 public static function wrapStreaming(callable $default, callable $streaming): callable
46 {
47 return static function (RequestInterface $request, array $options) use ($default, $streaming): PromiseInterface {
48 return empty($options['stream']) ? $default($request, $options) : $streaming($request, $options);
49 };
50 }
51 }
52