Source for file CaramelException.php

Documentation is available at CaramelException.php

  1. <?php
  2.  
  3. /**
  4.  * @package inc
  5.  * @subpackage utility
  6.  */
  7.  
  8. /**
  9.  * Import
  10.  */
  11. require_once BASEDIR.'/inc/model/ConfigurationModel.php';
  12.  
  13. /**
  14.  *
  15.  * CaramelException class
  16.  *
  17.  * @author Felix Rupp <kontakt@felixrupp.com>
  18.  * @version $Id$
  19.  * @copyright Copyright (c) 2011, Felix Rupp, Nicole Reinhardt
  20.  * @license http://www.opensource.org/licenses/mit-license.php MIT-License
  21.  * @license http://www.gnu.org/licenses/gpl.html GNU GPL
  22.  * 
  23.  * @package inc
  24.  * @subpackage utility
  25.  */
  26. class CaramelException extends Exception {
  27.     
  28.     
  29.     /**
  30.      * @var Array $_codeArray Array which assigns messages to errorcodes
  31.      */
  32.     private $_codeArray array(
  33.         10 => "XML-Error!",
  34.         11 => "XML-file could not be loaded!",
  35.         66 => "Bcrypt is not supported on this server!"
  36.     );
  37.     
  38.     /**
  39.      * @var String $_adminEmail eMail adress of the admin
  40.      */
  41.     private $_adminEmail "";
  42.     
  43.     
  44.     /**
  45.      * Constructor for CaramelException
  46.      * 
  47.      * @param int $caramelCode Errorcode
  48.      * @return void 
  49.      */
  50.     public function __construct($caramelCode{
  51.         
  52.         # Get Configurator
  53.         $this->_config ConfigurationModel::getConfigurationModel();
  54.     
  55.         $this->_adminEmail $this->_config->getAdminConfigStringAction("ADMIN_EMAIL");
  56.         
  57.         $this->code $caramelCode;
  58.         $this->message $this->_codeArray[$caramelCode];
  59.         
  60.     // End of constructor declaration
  61.     
  62.     
  63.     
  64.     /**
  65.      * Method to print exception details
  66.      * 
  67.      * @return void 
  68.      */
  69.     public function getDetails({
  70.         
  71.         print("</head><body><div style=\"margin: 20px auto; width: 80%; padding:12px 16px; border: 2px solid #ec4040; background-color: #fb8b8b; color:white; font-weight: bold; font-family: 'Courier New', Courier, monospace; font-size: 1.2em;\"><p>Error:</p><p>".$this->message."<br>raised in file: ".$this->file." at line: ".$this->line."</p><p>Please contact the administrator of this page via ".$this->_adminEmail.".</p></div></body></html>");
  72.         
  73.         exit;
  74.     
  75.     
  76.     // End of method declaration
  77.         
  78. }
  79.  
  80. ?>