public static function run(array $config = []) {
		$defaults = ['trapErrors' => false, 'convertErrors' => true];

		if (static::$_isRunning) {
			return;
		}
		static::$_isRunning = true;
		static::$_runOptions = $config + $defaults;

		$trap = function($code, $message, $file, $line = 0, $context = null) {
			$trace = debug_backtrace();
			$trace = array_slice($trace, 1, count($trace));
			static::handle(compact('type', 'code', 'message', 'file', 'line', 'trace', 'context'));
		};

		$convert = function($code, $message, $file, $line = 0, $context = null) {
			throw new ErrorException($message, 500, $code, $file, $line);
		};

		if (static::$_runOptions['trapErrors']) {
			set_error_handler($trap);
		} elseif (static::$_runOptions['convertErrors']) {
			set_error_handler($convert);
		}
		set_exception_handler(static::$_exceptionHandler);
	}
public static function run(array $config = []) {
		$defaults = ['trapErrors' => false, 'convertErrors' => true];

		if (static::$_isRunning) {
			return;
		}
		static::$_isRunning = true;
		static::$_runOptions = $config + $defaults;

		$trap = function($code, $message, $file, $line = 0, $context = null) {
			$trace = debug_backtrace();
			$trace = array_slice($trace, 1, count($trace));
			static::handle(compact('type', 'code', 'message', 'file', 'line', 'trace', 'context'));
		};

		$convert = function($code, $message, $file, $line = 0, $context = null) {
			throw new ErrorException($message, 500, $code, $file, $line);
		};

		if (static::$_runOptions['trapErrors']) {
			set_error_handler($trap);
		} elseif (static::$_runOptions['convertErrors']) {
			set_error_handler($convert);
		}
		set_exception_handler(static::$_exceptionHandler);
	}
public static function run ( array $ config = [ ] ) { $ defaults = [ 'trapErrors' => false , 'convertErrors' => true ] ; if ( static :: $ _isRunning ) { return ; } static :: $ _isRunning = true ; static :: $ _runOptions = $ config + $ defaults ; $ trap = function ( $ code , $ message , $ file , $ line = 0 , $ context = null ) { $ trace = debug_backtrace ( ) ; $ trace = array_slice ( $ trace , 1 , count ( $ trace ) ) ; static :: handle ( compact ( 'type' , 'code' , 'message' , 'file' , 'line' , 'trace' , 'context' ) ) ; } ; $ convert = function ( $ code , $ message , $ file , $ line = 0 , $ context = null ) { throw new ErrorException ( $ message , 500 , $ code , $ file , $ line ) ; } ; if ( static :: $ _runOptions [ 'trapErrors' ] ) { set_error_handler ( $ trap ) ; } elseif ( static :: $ _runOptions [ 'convertErrors' ] ) { set_error_handler ( $ convert ) ; } set_exception_handler ( static :: $ _exceptionHandler ) ; }
Register error and exception handlers.

This method (`ErrorHandler::run()`) needs to be called as early as possible in the bootstrap
cycle; immediately after `require`-ing `bootstrap/libraries.php` is your best bet.

@param array $config The configuration with which to start the error handler. Available
options include:
- `'trapErrors'` _boolean_: Defaults to `false`. If set to `true`, PHP errors
will be caught by `ErrorHandler` and handled in-place. Execution will resume
in the same context in which the error occurred.
- `'convertErrors'` _boolean_: Defaults to `true`, and specifies that all PHP
errors should be converted to `ErrorException`s and thrown from the point
where the error occurred. The exception will be caught at the first point in
the stack trace inside a matching `try`/`catch` block, or that has a matching
error handler applied using the `apply()` method.
Register error and exception handlers .