示例#1
0
 static function getInstance()
 {
     if (null === self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
示例#2
0
 static function exceptionHandler($exception)
 {
     $classname = get_class($exception);
     error($classname, ':', $exception->getCode(), '-', $exception->getMessage(), Araknid_Request::getInstance());
     switch ($classname) {
         case 'Araknid_Exception':
             $header = sprintf('%d - %s', $exception->getCode(), $exception->getMessage());
             header('HTTP/1.1 ' . $header);
             print "<h1>{$header}</h1>";
             switch ($exception->getCode()) {
                 case 404:
                     $msg = "<p>I did'nt find what you've requested.</p><q>I think you ought to know I'm feeling very depressed.</q>";
                     break;
                 case 500:
                     $msg = "<p>Something just happened and it's barely bad !</p><q>Incredible... it's even worse than I thought it would be.</q>";
                     break;
             }
             print $msg;
             return;
         case 'ErrorException':
     }
     printf('<h1>%s</h1>' . '<pre>%s</pre>', $classname, $exception);
 }