PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.6 28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 All 130 releases
← All changes | vendor_prefixed/guzzlehttp/guzzle/src/Handler/CurlHandler.php +0 -58 28.0 → trunk View file →
@@ -1,58 +1,0 @@
1 -<?php
2 -
3 -namespace YoastSEO_Vendor\GuzzleHttp\Handler;
4 -
5 -use YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface;
6 -use YoastSEO_Vendor\GuzzleHttp\TransportSharing;
7 -use YoastSEO_Vendor\Psr\Http\Message\RequestInterface;
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 - * @var CurlShareHandleState|null
25 - */
26 - private $shareHandleState;
27 - /**
28 - * Accepts an associative array of options:
29 - *
30 - * - handle_factory: Optional curl factory used to create cURL handles.
31 - * - transport_sharing: Optional transport sharing mode.
32 - *
33 - * @param array{handle_factory?: ?CurlFactoryInterface, transport_sharing?: mixed} $options Array of options to use with the handler
34 - */
35 - public function __construct(array $options = [])
36 - {
37 - \YoastSEO_Vendor\GuzzleHttp\Handler\CurlShareHandleState::assertNoRequiredSharingCustomFactoryConflict($options, 'CurlHandler');
38 - $transportSharing = $options['transport_sharing'] ?? null;
39 - $sharingMode = \YoastSEO_Vendor\GuzzleHttp\Handler\CurlShareHandleState::normalizeMode($transportSharing, 'transport_sharing');
40 - if (\array_key_exists('handle_factory', $options) && $options['handle_factory'] !== null) {
41 - $this->shareHandleState = null;
42 - $this->factory = $options['handle_factory'];
43 - return;
44 - }
45 - $this->shareHandleState = $sharingMode !== \YoastSEO_Vendor\GuzzleHttp\TransportSharing::NONE ? \YoastSEO_Vendor\GuzzleHttp\Handler\CurlShareHandleState::fromOption($transportSharing) : null;
46 - $this->factory = $this->shareHandleState !== null ? new \YoastSEO_Vendor\GuzzleHttp\Handler\CurlFactory(3, $this->shareHandleState->mode, $this->shareHandleState->handle) : new \YoastSEO_Vendor\GuzzleHttp\Handler\CurlFactory(3);
47 - }
48 - public function __invoke(\YoastSEO_Vendor\Psr\Http\Message\RequestInterface $request, array $options) : \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface
49 - {
50 - if (isset($options['delay'])) {
51 - \usleep($options['delay'] * 1000);
52 - }
53 - $easy = $this->factory->create($request, $options);
54 - \curl_exec($easy->handle);
55 - $easy->errno = \curl_errno($easy->handle);
56 - return \YoastSEO_Vendor\GuzzleHttp\Handler\CurlFactory::finish($this, $easy, $this->factory);
57 - }
58 -}