1 <?php
2 /* --------------------------------------------------------------
3 HttpControllerResponse.inc.php 2015-03-12 gm
4 Gambio GmbH
5 http://www.gambio.de
6 Copyright (c) 2015 Gambio GmbH
7 Released under the GNU General Public License (Version 2)
8 [http://www.gnu.org/licenses/gpl-2.0.html]
9 --------------------------------------------------------------
10 */
11
12 MainFactory::load_class('HttpControllerResponseInterface');
13
14 /**
15 * Class HttpControllerResponse
16 *
17 * @category System
18 * @package Http
19 * @subpackage ValueObjects
20 * @extends HttpControllerResponseInterface
21 */
22 class HttpControllerResponse implements HttpControllerResponseInterface
23 {
24 /**
25 * @var array
26 */
27 protected $httpHeadersArray = array();
28
29 /**
30 * @var string
31 */
32 protected $httpBody;
33
34
35 /**
36 * Initializes the http controller response.
37 *
38 * @param string $responseBody Rendered html markup.
39 * @param array $responseHeadersArray Array which contains information about the http response headers.
40 */
41 public function __construct($responseBody, $responseHeadersArray = null)
42 {
43 if($responseHeadersArray !== null)
44 {
45 $this->httpHeadersArray = $responseHeadersArray;
46 }
47 $this->httpBody = $responseBody;
48 }
49
50
51 /**
52 * Returns the response headers array.
53 *
54 * @return array
55 */
56 public function getHeaders()
57 {
58 return $this->httpHeadersArray;
59 }
60
61
62 /**
63 * Returns the response body string.
64 *
65 * @return string
66 */
67 public function getBody()
68 {
69 return $this->httpBody;
70 }
71 }