[Debug] ensured that the Debug tools can only be registered once

This commit is contained in:
Fabien Potencier 2013-03-21 08:33:19 +01:00
parent 946bfb2180
commit e455269ba3
3 changed files with 20 additions and 2 deletions

View File

@ -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);

View File

@ -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)
*

View File

@ -41,7 +41,7 @@ class ExceptionHandler
}
/**
* Register the exception handler.
* Registers the exception handler.
*
* @param Boolean $debug
*