123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <?php
- namespace GuzzleHttp;
- use Psr\Http\Message\RequestInterface;
- use Psr\Http\Message\ResponseInterface;
- use Psr\Http\Message\UriInterface;
- final class TransferStats
- {
-
- private $request;
-
- private $response;
-
- private $transferTime;
-
- private $handlerStats;
-
- private $handlerErrorData;
-
- public function __construct(
- RequestInterface $request,
- ResponseInterface $response = null,
- float $transferTime = null,
- $handlerErrorData = null,
- array $handlerStats = []
- ) {
- $this->request = $request;
- $this->response = $response;
- $this->transferTime = $transferTime;
- $this->handlerErrorData = $handlerErrorData;
- $this->handlerStats = $handlerStats;
- }
- public function getRequest(): RequestInterface
- {
- return $this->request;
- }
-
- public function getResponse(): ?ResponseInterface
- {
- return $this->response;
- }
-
- public function hasResponse(): bool
- {
- return $this->response !== null;
- }
-
- public function getHandlerErrorData()
- {
- return $this->handlerErrorData;
- }
-
- public function getEffectiveUri(): UriInterface
- {
- return $this->request->getUri();
- }
-
- public function getTransferTime(): ?float
- {
- return $this->transferTime;
- }
-
- public function getHandlerStats(): array
- {
- return $this->handlerStats;
- }
-
- public function getHandlerStat(string $stat)
- {
- return $this->handlerStats[$stat] ?? null;
- }
- }
|