1 <?php
2 /* --------------------------------------------------------------
3 RedirectHttpControllerResponse.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('HttpControllerResponse');
13
14 /**
15 * Class RedirectHttpControllerResponse
16 *
17 * @category System
18 * @package Http
19 * @subpackage ValueObjects
20 * @extends HttpControllerResponse
21 */
22 class RedirectHttpControllerResponse extends HttpControllerResponse
23 {
24 /**
25 * Initializes the redirect http controller response.
26 *
27 * @param string $location Location to redirect.
28 * @param bool $movedPermanently Add status code 301 (Moved Permanently) to the http header.
29 */
30 public function __construct($location, $movedPermanently = false)
31 {
32 if($movedPermanently)
33 {
34 $this->httpHeadersArray[] = 'HTTP/1.1 301 Moved Permanently';
35 }
36 $this->httpHeadersArray[] = 'Location: ' . $location;
37 }
38 }