PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.1
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.1
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 18.1, at vendor_prefixed/guzzlehttp/guzzle/src/TransferStats.php

111 lines 3.1 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 private $request;
15 private $response;
16 private $transferTime;
17 private $handlerStats;
18 private $handlerErrorData;
19 /**
20 * @param RequestInterface $request Request that was sent.
21 * @param ResponseInterface|null $response Response received (if any)
22 * @param float|null $transferTime Total handler transfer time.
23 * @param mixed $handlerErrorData Handler error data.
24 * @param array $handlerStats Handler specific stats.
25 */
26 public function __construct(\YoastSEO_Vendor\Psr\Http\Message\RequestInterface $request, \YoastSEO_Vendor\Psr\Http\Message\ResponseInterface $response = null, $transferTime = null, $handlerErrorData = null, $handlerStats = [])
27 {
28 $this->request = $request;
29 $this->response = $response;
30 $this->transferTime = $transferTime;
31 $this->handlerErrorData = $handlerErrorData;
32 $this->handlerStats = $handlerStats;
33 }
34 /**
35 * @return RequestInterface
36 */
37 public function getRequest()
38 {
39 return $this->request;
40 }
41 /**
42 * Returns the response that was received (if any).
43 *
44 * @return ResponseInterface|null
45 */
46 public function getResponse()
47 {
48 return $this->response;
49 }
50 /**
51 * Returns true if a response was received.
52 *
53 * @return bool
54 */
55 public function hasResponse()
56 {
57 return $this->response !== null;
58 }
59 /**
60 * Gets handler specific error data.
61 *
62 * This might be an exception, a integer representing an error code, or
63 * anything else. Relying on this value assumes that you know what handler
64 * you are using.
65 *
66 * @return mixed
67 */
68 public function getHandlerErrorData()
69 {
70 return $this->handlerErrorData;
71 }
72 /**
73 * Get the effective URI the request was sent to.
74 *
75 * @return UriInterface
76 */
77 public function getEffectiveUri()
78 {
79 return $this->request->getUri();
80 }
81 /**
82 * Get the estimated time the request was being transferred by the handler.
83 *
84 * @return float|null Time in seconds.
85 */
86 public function getTransferTime()
87 {
88 return $this->transferTime;
89 }
90 /**
91 * Gets an array of all of the handler specific transfer data.
92 *
93 * @return array
94 */
95 public function getHandlerStats()
96 {
97 return $this->handlerStats;
98 }
99 /**
100 * Get a specific handler statistic from the handler by name.
101 *
102 * @param string $stat Handler specific transfer stat to retrieve.
103 *
104 * @return mixed|null
105 */
106 public function getHandlerStat($stat)
107 {
108 return isset($this->handlerStats[$stat]) ? $this->handlerStats[$stat] : null;
109 }
110 }
111