PluginProbe
Media Cloud Sync / 1.4.1
Media Cloud Sync v1.4.1
1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 All 35 releases
← All changes | includes/sdk/s3/GuzzleHttp/TransferStats.php +24 -20 1.2.21.4.1 View file →
@@ -10,12 +10,27 @@
10 10 * or after a network error.
11 11 */
12 12 final class TransferStats
13 13 {
14 + /**
15 + * @var RequestInterface
16 + */
14 17 private $request;
18 + /**
19 + * @var ResponseInterface|null
20 + */
15 21 private $response;
22 + /**
23 + * @var float|null
24 + */
16 25 private $transferTime;
26 + /**
27 + * @var array
28 + */
17 29 private $handlerStats;
30 + /**
31 + * @var mixed|null
32 + */
18 33 private $handlerErrorData;
19 34 /**
20 35 * @param RequestInterface $request Request that was sent.
21 36 * @param ResponseInterface|null $response Response received (if any)
@@ -22,9 +37,9 @@
22 37 * @param float|null $transferTime Total handler transfer time.
23 38 * @param mixed $handlerErrorData Handler error data.
24 39 * @param array $handlerStats Handler specific stats.
25 40 */
26 - public function __construct(RequestInterface $request, ResponseInterface $response = null, $transferTime = null, $handlerErrorData = null, $handlerStats = [])
41 + public function __construct(RequestInterface $request, ?ResponseInterface $response = null, ?float $transferTime = null, $handlerErrorData = null, array $handlerStats = [])
27 42 {
28 43 $this->request = $request;
29 44 $this->response = $response;
30 45 $this->transferTime = $transferTime;
@@ -30,30 +45,23 @@
30 45 $this->transferTime = $transferTime;
31 46 $this->handlerErrorData = $handlerErrorData;
32 47 $this->handlerStats = $handlerStats;
33 48 }
34 - /**
35 - * @return RequestInterface
36 - */
37 - public function getRequest()
49 + public function getRequest() : RequestInterface
38 50 {
39 51 return $this->request;
40 52 }
41 53 /**
42 54 * Returns the response that was received (if any).
43 - *
44 - * @return ResponseInterface|null
45 55 */
46 - public function getResponse()
56 + public function getResponse() : ?ResponseInterface
47 57 {
48 58 return $this->response;
49 59 }
50 60 /**
51 61 * Returns true if a response was received.
52 - *
53 - * @return bool
54 62 */
55 - public function hasResponse()
63 + public function hasResponse() : bool
56 64 {
57 65 return $this->response !== null;
58 66 }
59 67 /**
@@ -70,12 +78,10 @@
70 78 return $this->handlerErrorData;
71 79 }
72 80 /**
73 81 * Get the effective URI the request was sent to.
74 - *
75 - * @return UriInterface
76 82 */
77 - public function getEffectiveUri()
83 + public function getEffectiveUri() : UriInterface
78 84 {
79 85 return $this->request->getUri();
80 86 }
81 87 /**
@@ -82,18 +88,16 @@
82 88 * Get the estimated time the request was being transferred by the handler.
83 89 *
84 90 * @return float|null Time in seconds.
85 91 */
86 - public function getTransferTime()
92 + public function getTransferTime() : ?float
87 93 {
88 94 return $this->transferTime;
89 95 }
90 96 /**
91 97 * Gets an array of all of the handler specific transfer data.
92 - *
93 - * @return array
94 98 */
95 - public function getHandlerStats()
99 + public function getHandlerStats() : array
96 100 {
97 101 return $this->handlerStats;
98 102 }
99 103 /**
@@ -102,9 +106,9 @@
102 106 * @param string $stat Handler specific transfer stat to retrieve.
103 107 *
104 108 * @return mixed|null
105 109 */
106 - public function getHandlerStat($stat)
110 + public function getHandlerStat(string $stat)
107 111 {
108 - return isset($this->handlerStats[$stat]) ? $this->handlerStats[$stat] : null;
112 + return $this->handlerStats[$stat] ?? null;
109 113 }
110 114 }