1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
<?php
/**
* Copyright 2007-2014 Horde LLC (http://www.horde.org/)
*
* @author Michael Cramer <michael@bigmichi1.de>
* @license http://www.horde.org/licenses/bsd BSD
* @category Horde
* @package Http
*/
/**
* @author Michael Cramer <michael@bigmichi1.de>
* @license http://www.horde.org/licenses/bsd BSD
* @category Horde
* @package Http
*/
class Horde_Http_Response_Peclhttp2 extends Horde_Http_Response_Base
{
/**
* HttpMessage object.
*
* @var \http\Client\Response
*/
protected $_response;
/**
* Constructor.
*
* @param string $uri
* @param \http\Client\Response $response
*/
public function __construct($uri, \http\Client\Response $response)
{
try {
$parent = $response->getParentMessage();
$location = $parent->getHeader('Location');
$this->uri = $location;
} catch (HttpRuntimeException $e) {
$this->uri = $uri;
}
$this->httpVersion = $response->getHttpVersion();
$this->code = $response->getResponseCode();
$this->_response = $response;
foreach ($response->getHeaders() as $k => $v) {
$this->headers[strtolower($k)] = $v;
}
}
public function getBody()
{
return $this->_response->getBody()->toString();
}
}
|