<?
 
//Instanciate the class
 
//The first argument is a number between 0 and 15. It's the max level at which an exception would be thrown.
 
//The second argument is a boolean. It allows you to change the exceptions level after instanciation if set to true.
 
$exM = new ExceptionsManager(ExceptionsManager::EX_MEDIUM, false);
 
//The main idea is to use the class constants for the first value, but you could also use any int between 0 and 15.
 
 
//To throw an exception use:
 
$exM->ThrowException(new Exception('Error'), ExceptionsManager::EX_HIGH); //This one will be thrown: EX_HIGH<EX_MEDIUM
 
$exM->ThrowException(new Exception('Another Error'), ExceptionsManager::EX_MEDIUM+1); //This one won't be thrown: EX_MEDIUM+1>EX_MEDIUM
 
 
//To change the max exceptions level use:
 
if ($exM->CanChangeExceptionsLevel()) { //checks whether you can change the exceptions level
 
    $exM->ChangeExceptionsLevel(ExceptionsManager::EX_FATAL); //changes the exceptions level
 
}
 
//$exM->ChangeExceptionsLevel will throw an exception if the class is instanciated with the second argument false
 
 
//To get the current exceptions level use:
 
$a = $exM->GetExceptionsLevel();
 
 
//To check whether a certian level exception will be thrown
 
$b = $exM->WillThrowException(10); //returns bool
 
 
//Note: EX_FATAL is ALWAYS thrown!
 
?>
 
 |