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 / CurlHandler.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
CurlHandler.php
50 lines
1 <?php
2
3 namespace GuzzleHttp\Handler;
4
5 use GuzzleHttp\Promise\PromiseInterface;
6 use Psr\Http\Message\RequestInterface;
7
8 /**
9 * HTTP handler that uses cURL easy handles as a transport layer.
10 *
11 * When using the CurlHandler, custom curl options can be specified as an
12 * associative array of curl option constants mapping to values in the
13 * **curl** key of the "client" key of the request.
14 *
15 * @final
16 */
17 class CurlHandler
18 {
19 /**
20 * @var CurlFactoryInterface
21 */
22 private $factory;
23
24 /**
25 * Accepts an associative array of options:
26 *
27 * - handle_factory: Optional curl factory used to create cURL handles.
28 *
29 * @param array{handle_factory?: ?CurlFactoryInterface} $options Array of options to use with the handler
30 */
31 public function __construct(array $options = [])
32 {
33 $this->factory = $options['handle_factory']
34 ?? new CurlFactory(3);
35 }
36
37 public function __invoke(RequestInterface $request, array $options): PromiseInterface
38 {
39 if (isset($options['delay'])) {
40 \usleep($options['delay'] * 1000);
41 }
42
43 $easy = $this->factory->create($request, $options);
44 \curl_exec($easy->handle);
45 $easy->errno = \curl_errno($easy->handle);
46
47 return CurlFactory::finish($this, $easy, $this->factory);
48 }
49 }
50