GuzzleHttpTransferStats

Represents data at the point after it was transferred either successfully or after a network error.

Defined (1)

The class is defined in the following location(s).

/lib/Azure/GuzzleHttp/TransferStats.php  
  1. final class TransferStats 
  2. private $request; 
  3. private $response; 
  4. private $transferTime; 
  5. private $handlerStats; 
  6. private $handlerErrorData; 
  7.  
  8. /** 
  9. * @param RequestInterface $request Request that was sent. 
  10. * @param ResponseInterface $response Response received (if any) 
  11. * @param null $transferTime Total handler transfer time. 
  12. * @param mixed $handlerErrorData Handler error data. 
  13. * @param array $handlerStats Handler specific stats. 
  14. */ 
  15. public function __construct( 
  16. RequestInterface $request,  
  17. ResponseInterface $response = null,  
  18. $transferTime = null,  
  19. $handlerErrorData = null,  
  20. $handlerStats = [] 
  21. ) { 
  22. $this->request = $request; 
  23. $this->response = $response; 
  24. $this->transferTime = $transferTime; 
  25. $this->handlerErrorData = $handlerErrorData; 
  26. $this->handlerStats = $handlerStats; 
  27.  
  28. /** 
  29. * @return RequestInterface 
  30. */ 
  31. public function getRequest() 
  32. return $this->request; 
  33.  
  34. /** 
  35. * Returns the response that was received (if any). 
  36. * @return ResponseInterface|null 
  37. */ 
  38. public function getResponse() 
  39. return $this->response; 
  40.  
  41. /** 
  42. * Returns true if a response was received. 
  43. * @return bool 
  44. */ 
  45. public function hasResponse() 
  46. return $this->response !== null; 
  47.  
  48. /** 
  49. * Gets handler specific error data. 
  50. * This might be an exception, a integer representing an error code, or 
  51. * anything else. Relying on this value assumes that you know what handler 
  52. * you are using. 
  53. * @return mixed 
  54. */ 
  55. public function getHandlerErrorData() 
  56. return $this->handlerErrorData; 
  57.  
  58. /** 
  59. * Get the effective URI the request was sent to. 
  60. * @return UriInterface 
  61. */ 
  62. public function getEffectiveUri() 
  63. return $this->request->getUri(); 
  64.  
  65. /** 
  66. * Get the estimated time the request was being transferred by the handler. 
  67. * @return float Time in seconds. 
  68. */ 
  69. public function getTransferTime() 
  70. return $this->transferTime; 
  71.  
  72. /** 
  73. * Gets an array of all of the handler specific transfer data. 
  74. * @return array 
  75. */ 
  76. public function getHandlerStats() 
  77. return $this->handlerStats; 
  78.  
  79. /** 
  80. * Get a specific handler statistic from the handler by name. 
  81. * @param string $stat Handler specific transfer stat to retrieve. 
  82. * @return mixed|null 
  83. */ 
  84. public function getHandlerStat($stat) 
  85. return isset($this->handlerStats[$stat]) 
  86. ? $this->handlerStats[$stat] 
  87. : null;