/Nette/Application/Responses/RedirectingResponse.php
PHP | 88 lines | 25 code | 23 blank | 40 comment | 0 complexity | f20a67a766c52831bb7147417ca8f82e MD5 | raw file
Possible License(s): BSD-3-Clause
- <?php
- /**
- * Nette Framework
- *
- * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
- *
- * This source file is subject to the "Nette license" that is bundled
- * with this package in the file license.txt.
- *
- * For more information please see http://nettephp.com
- *
- * @copyright Copyright (c) 2004, 2009 David Grudl
- * @license http://nettephp.com/license Nette license
- * @link http://nettephp.com
- * @category Nette
- * @package Nette\Application
- */
- /*namespace Nette\Application;*/
- require_once dirname(__FILE__) . '/../../Object.php';
- require_once dirname(__FILE__) . '/../../Application/IPresenterResponse.php';
- /**
- * Redirects to new request.
- *
- * @author David Grudl
- * @copyright Copyright (c) 2004, 2009 David Grudl
- * @package Nette\Application
- */
- class RedirectingResponse extends /*Nette\*/Object implements IPresenterResponse
- {
- /** @var string */
- private $uri;
- /** @var int */
- private $code;
- /**
- * @param string URI
- * @param int HTTP code 3xx
- */
- public function __construct($uri, $code = /*Nette\Web\*/IHttpResponse::S302_FOUND)
- {
- $this->uri = (string) $uri;
- $this->code = (int) $code;
- }
- /**
- * @return string
- */
- final public function getUri()
- {
- return $this->uri;
- }
- /**
- * @return int
- */
- final public function getCode()
- {
- return $this->code;
- }
- /**
- * Sends response to output.
- * @return void
- */
- public function send()
- {
- /*Nette\*/Environment::getHttpResponse()->redirect($this->uri, $this->code);
- }
- }