1<?php 2/** 3 * Copyright 2007-2016 Horde LLC (http://www.horde.org/) 4 * 5 * @author Chuck Hagenbuch <chuck@horde.org> 6 * @license http://www.horde.org/licenses/bsd BSD 7 * @category Horde 8 * @package Http 9 */ 10 11/** 12 * @author Chuck Hagenbuch <chuck@horde.org> 13 * @license http://www.horde.org/licenses/bsd BSD 14 * @category Horde 15 * @package Http 16 */ 17class Horde_Http_Response_Mock extends Horde_Http_Response_Base 18{ 19 /** 20 * Constructor 21 */ 22 public function __construct($uri, $stream, $headers = array()) 23 { 24 $this->uri = $uri; 25 $this->_stream = $stream; 26 $this->_parseHeaders($headers); 27 } 28 29 public function getBody() 30 { 31 $content = @stream_get_contents($this->_stream); 32 if ($content === false) { 33 throw new Horde_Http_Exception('Problem reading data from ' . $this->uri . ': ' . $php_errormsg); 34 } 35 return $content; 36 } 37} 38