Browse Source
Code refactoring, #16
Code refactoring, #16
git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/branches/evo@115 4cb57b5f-5bbd-dd11-951b-001d605cbbc5master
pzinovkin
15 years ago
5 changed files with 120 additions and 33 deletions
-
43Load.php
-
19app/FrontController.php
-
23exception/Error404Exception.php
-
29exception/GeneralException.php
-
15util/AutoloadBuilder.php
@ -0,0 +1,23 @@ |
|||
<?php |
|||
/** |
|||
* @copyright NetMonsters <team@netmonsters.ru> |
|||
* @link http://netmonsters.ru |
|||
* @package Majestic |
|||
* @subpackage exception |
|||
* @since 2010-02-26 |
|||
* @version SVN: $Id$ |
|||
* @filesource $URL$ |
|||
*/ |
|||
|
|||
class Error404Exception extends GeneralException |
|||
{ |
|||
protected $code = 404; |
|||
|
|||
protected function sendHeader() |
|||
{ |
|||
if (! headers_sent()) { |
|||
header('HTTP/1.0 404 Not Found'); |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,29 @@ |
|||
<?php |
|||
/** |
|||
* @copyright NetMonsters <team@netmonsters.ru> |
|||
* @link http://netmonsters.ru |
|||
* @package Majestic |
|||
* @subpackage exception |
|||
* @since 2010-02-26 |
|||
* @version SVN: $Id$ |
|||
* @filesource $URL$ |
|||
*/ |
|||
|
|||
class GeneralException extends Exception |
|||
{ |
|||
|
|||
protected $code = 500; |
|||
|
|||
protected function sendHeader() |
|||
{ |
|||
if (!headers_sent()) { |
|||
header('HTTP/1.0 500 Internal Server Error'); |
|||
} |
|||
} |
|||
|
|||
public function toHtml() |
|||
{ |
|||
$this->sendHeader(); |
|||
return 'Exception caught: ' . $this->getMessage(); |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue