PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.5
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.5
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 19.0 All 129 releases
wordpress-seo / vendor_prefixed / guzzlehttp / guzzle / src / TransferStats.php

TransferStats.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.5, at vendor_prefixed/guzzlehttp/guzzle/src/TransferStats.php

115 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace YoastSEO_Vendor\GuzzleHttp;
4
5 use YoastSEO_Vendor\Psr\Http\Message\RequestInterface;
6 use YoastSEO_Vendor\Psr\Http\Message\ResponseInterface;
7 use YoastSEO_Vendor\Psr\Http\Message\UriInterface;
8 /**
9 * Represents data at the point after it was transferred either successfully
10 * or after a network error.
11 */
12 final class TransferStats
13 {
14 /**
15 * @var RequestInterface
16 */
17 private $request;
18 /**
19 * @var ResponseInterface|null
20 */
21 private $response;
22 /**
23 * @var float|null
24 */
25 private $transferTime;
26 /**
27 * @var array
28 */
29 private $handlerStats;
30 /**
31 * @var mixed|null
32 */
33 private $handlerErrorData;
34 /**
35 * @param RequestInterface $request Request that was sent.
36 * @param ResponseInterface|null $response Response received (if any)
37 * @param float|null $transferTime Total handler transfer time.
38 * @param mixed $handlerErrorData Handler error data.
39 * @param array $handlerStats Handler specific stats.
40 */
41 public function __construct(\YoastSEO_Vendor\Psr\Http\Message\RequestInterface $request, ?\YoastSEO_Vendor\Psr\Http\Message\ResponseInterface $response = null, ?float $transferTime = null, $handlerErrorData = null, array $handlerStats = [])
42 {
43 $this->request = $request;
44 $this->response = $response;
45 $this->transferTime = $transferTime;
46 $this->handlerErrorData = $handlerErrorData;
47 $this->handlerStats = $handlerStats;
48 }
49 public function getRequest() : \YoastSEO_Vendor\Psr\Http\Message\RequestInterface
50 {
51 return $this->request;
52 }
53 /**
54 * Returns the response that was received (if any).
55 */
56 public function getResponse() : ?\YoastSEO_Vendor\Psr\Http\Message\ResponseInterface
57 {
58 return $this->response;
59 }
60 /**
61 * Returns true if a response was received.
62 */
63 public function hasResponse() : bool
64 {
65 return $this->response !== null;
66 }
67 /**
68 * Gets handler specific error data.
69 *
70 * This might be an exception, a integer representing an error code, or
71 * anything else. Relying on this value assumes that you know what handler
72 * you are using.
73 *
74 * @return mixed
75 */
76 public function getHandlerErrorData()
77 {
78 return $this->handlerErrorData;
79 }
80 /**
81 * Get the effective URI the request was sent to.
82 */
83 public function getEffectiveUri() : \YoastSEO_Vendor\Psr\Http\Message\UriInterface
84 {
85 return $this->request->getUri();
86 }
87 /**
88 * Get the estimated time the request was being transferred by the handler.
89 *
90 * @return float|null Time in seconds.
91 */
92 public function getTransferTime() : ?float
93 {
94 return $this->transferTime;
95 }
96 /**
97 * Gets an array of all of the handler specific transfer data.
98 */
99 public function getHandlerStats() : array
100 {
101 return $this->handlerStats;
102 }
103 /**
104 * Get a specific handler statistic from the handler by name.
105 *
106 * @param string $stat Handler specific transfer stat to retrieve.
107 *
108 * @return mixed|null
109 */
110 public function getHandlerStat(string $stat)
111 {
112 return $this->handlerStats[$stat] ?? null;
113 }
114 }
115