|
|
|
@ -33,18 +33,27 @@ class Response implements IResponse { |
|
|
|
|
/** @var GuzzleResponse */ |
|
|
|
|
private $response; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @var bool |
|
|
|
|
*/ |
|
|
|
|
private $stream; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param GuzzleResponse $response |
|
|
|
|
* @param bool $stream |
|
|
|
|
*/ |
|
|
|
|
public function __construct(GuzzleResponse $response) { |
|
|
|
|
public function __construct(GuzzleResponse $response, $stream = false) { |
|
|
|
|
$this->response = $response; |
|
|
|
|
$this->stream = $stream; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @return string |
|
|
|
|
* @return string|resource |
|
|
|
|
*/ |
|
|
|
|
public function getBody() { |
|
|
|
|
return $this->response->getBody()->getContents(); |
|
|
|
|
return $this->stream ? |
|
|
|
|
$this->response->getBody()->detach(): |
|
|
|
|
$this->response->getBody()->getContents(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|