[Debug] ensured that the Debug tools can only be registered once
This commit is contained in:
parent
946bfb2180
commit
e455269ba3
@ -20,8 +20,26 @@ use Symfony\Component\ClassLoader\DebugClassLoader;
|
||||
*/
|
||||
class Debug
|
||||
{
|
||||
private static $enabled = false;
|
||||
|
||||
/**
|
||||
* Enables the debug tools.
|
||||
*
|
||||
* This method registers an error handler and an exception handler.
|
||||
*
|
||||
* If the Symfony ClassLoader component is available, a special
|
||||
* class loader is also registered.
|
||||
*
|
||||
* @param integer $errorReportingLevel The level of error reporting you wan
|
||||
*/
|
||||
public static function enable($errorReportingLevel = null)
|
||||
{
|
||||
if (static::$enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
static::$enabled = true;
|
||||
|
||||
error_reporting(-1);
|
||||
ini_set('display_errors', 0);
|
||||
|
||||
|
@ -47,7 +47,7 @@ class ErrorHandler
|
||||
private static $logger;
|
||||
|
||||
/**
|
||||
* Register the error handler.
|
||||
* Registers the error handler.
|
||||
*
|
||||
* @param integer $level The level at which the conversion to Exception is done (null to use the error_reporting() value and 0 to disable)
|
||||
*
|
||||
|
@ -41,7 +41,7 @@ class ExceptionHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the exception handler.
|
||||
* Registers the exception handler.
|
||||
*
|
||||
* @param Boolean $debug
|
||||
*
|
||||
|
Reference in New Issue
Block a user