1<?php 2/** 3 * Copyright 2007-2016 Horde LLC (http://www.horde.org/) 4 * 5 * @author Michael Cramer <michael@bigmichi1.de> 6 * @license http://www.horde.org/licenses/bsd BSD 7 * @category Horde 8 * @package Http 9 */ 10 11/** 12 * @author Michael Cramer <michael@bigmichi1.de> 13 * @license http://www.horde.org/licenses/bsd BSD 14 * @category Horde 15 * @package Http 16 */ 17class Horde_Http_Response_Peclhttp2 extends Horde_Http_Response_Base 18{ 19 /** 20 * HttpMessage object. 21 * 22 * @var \http\Client\Response 23 */ 24 protected $_response; 25 26 /** 27 * Constructor. 28 * 29 * @param string $uri 30 * @param \http\Client\Response $response 31 */ 32 public function __construct($uri, \http\Client\Response $response) 33 { 34 try { 35 $info = $response->getTransferInfo(); 36 } catch (\http\Exception $e) { 37 throw new Horde_Http_Exception($e); 38 } 39 try { 40 $this->uri = $info->effective_url; 41 } catch (\http\Exception\RuntimeException $e) { 42 $this->uri = $uri; 43 } 44 45 $this->httpVersion = $response->getHttpVersion(); 46 $this->code = $info->response_code; 47 $this->_response = $response; 48 $this->_headers = new Horde_Support_CaseInsensitiveArray( 49 $response->getHeaders() 50 ); 51 $this->headers = array_change_key_case($this->_headers->getArrayCopy()); 52 } 53 54 public function getBody() 55 { 56 return $this->_response->getBody()->toString(); 57 } 58} 59