PluginProbe ʕ •ᴥ•ʔ
ShareThis Dashboard for Google Analytics / 3.2.1
ShareThis Dashboard for Google Analytics v3.2.1
3.3.2 trunk 1.0.7 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2.5 2.3.5 2.3.6 2.3.7 2.3.8 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 3.0.0 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.3.0 3.3.1
googleanalytics / lib / analytics-admin / vendor / guzzlehttp / guzzle / src / Handler / Proxy.php
googleanalytics / lib / analytics-admin / vendor / guzzlehttp / guzzle / src / Handler Last commit date
CurlFactory.php 3 years ago CurlFactoryInterface.php 3 years ago CurlHandler.php 3 years ago CurlMultiHandler.php 2 years ago EasyHandle.php 3 years ago HeaderProcessor.php 3 years ago MockHandler.php 3 years ago Proxy.php 3 years ago StreamHandler.php 3 years ago
Proxy.php
52 lines
1 <?php
2
3 namespace GuzzleHttp\Handler;
4
5 use GuzzleHttp\Promise\PromiseInterface;
6 use GuzzleHttp\RequestOptions;
7 use 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(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $default Handler used for normal responses
21 * @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $sync Handler used for synchronous responses.
22 *
23 * @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\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(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $default Handler used for non-streaming responses
41 * @param callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\PromiseInterface $streaming Handler used for streaming responses
42 *
43 * @return callable(\Psr\Http\Message\RequestInterface, array): \GuzzleHttp\Promise\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