Axiom (v1.2.0)

A lightweight PHP framework
H:/Workspace/php-axiom/www/php-axiom/libraries/axiom/axRedirectException.class.php
Go to the documentation of this file.
00001 <?php
00017 class axRedirectException extends Exception {
00018     
00023     const REDIRECT_PERMANENT = 1;
00024     const REDIRECT_REFRESH = 2;
00025     
00030     const REFRESH_DELAY = 5;
00031     
00036     protected $_url;
00037     
00042     protected $_method;
00043     
00049     public function __construct ($url, $method = self::REDIRECT_PERMANENT) {
00050         parent::__construct("Redirect to $url");
00051         $this->_url = $url;
00052         $this->_method = $method;
00053     }
00054     
00059     public function getUrl () {
00060         return $this->_url;
00061     }
00062     
00067     public function getMethod () {
00068         return $this->_method;
00069     }
00070     
00078     public function getHeaderString () {
00079         switch ($this->_method) {
00080             case self::REDIRECT_REFRESH:   return "Refresh: " . self::REFRESH_DELAY . ";url={$this->_url}"; break;
00081             case self::REDIRECT_PERMANENT: return "Location: {$this->_url}"; break;
00082         }
00083         return false;
00084     }
00085     
00090     public function __toString () {
00091         return ($header = $this->getHeaderString()) ? $header : "";
00092     }
00093 }
 All Data Structures Files Functions Variables