[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 namespace GuzzleHttp\Event; 3 4 use GuzzleHttp\Message\ResponseInterface; 5 use GuzzleHttp\Ring\Future\FutureInterface; 6 7 /** 8 * Event that contains transfer statistics, and can be intercepted. 9 */ 10 abstract class AbstractTransferEvent extends AbstractRequestEvent 11 { 12 /** 13 * Get all transfer information as an associative array if no $name 14 * argument is supplied, or gets a specific transfer statistic if 15 * a $name attribute is supplied (e.g., 'total_time'). 16 * 17 * @param string $name Name of the transfer stat to retrieve 18 * 19 * @return mixed|null|array 20 */ 21 public function getTransferInfo($name = null) 22 { 23 if (!$name) { 24 return $this->transaction->transferInfo; 25 } 26 27 return isset($this->transaction->transferInfo[$name]) 28 ? $this->transaction->transferInfo[$name] 29 : null; 30 } 31 32 /** 33 * Returns true/false if a response is available. 34 * 35 * @return bool 36 */ 37 public function hasResponse() 38 { 39 return !($this->transaction->response instanceof FutureInterface); 40 } 41 42 /** 43 * Get the response. 44 * 45 * @return ResponseInterface|null 46 */ 47 public function getResponse() 48 { 49 return $this->hasResponse() ? $this->transaction->response : null; 50 } 51 52 /** 53 * Intercept the request and associate a response 54 * 55 * @param ResponseInterface $response Response to set 56 */ 57 public function intercept(ResponseInterface $response) 58 { 59 $this->transaction->response = $response; 60 $this->transaction->exception = null; 61 $this->stopPropagation(); 62 } 63 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |