src/ExceptionHandler.php
public static function enable($state = true, $enable_assert = false){

		$state = (bool) $state;

		self::enableAssert((bool) $enable_assert);

		if($state && self::$_enabled || !$state && !self::$_enabled){

			return;
		}

		if($state){

			set_exception_handler(__CLASS__ . '::exception');
			set_error_handler(__CLASS__ . '::error', error_reporting());
			assert_options(ASSERT_CALLBACK, __CLASS__ . '::assert');

			self::$_enabled = true;
		}
		else{

			restore_exception_handler();
			restore_error_handler();

			/*
			 * According to the PHP documentation this should reset to NULL,
			 * but doing so generates an error when evaluating assertions, so
			 * we instead revert to an empty function...
			 */

			assert_options(ASSERT_CALLBACK, function(){});

			self::$_enabled = false;
		}
	}
public static function enable($state = true, $enable_assert = false){

		$state = (bool) $state;

		self::enableAssert((bool) $enable_assert);

		if($state && self::$_enabled || !$state && !self::$_enabled){

			return;
		}

		if($state){

			set_exception_handler(__CLASS__ . '::exception');
			set_error_handler(__CLASS__ . '::error', error_reporting());
			assert_options(ASSERT_CALLBACK, __CLASS__ . '::assert');

			self::$_enabled = true;
		}
		else{

			restore_exception_handler();
			restore_error_handler();

			/*
			 * According to the PHP documentation this should reset to NULL,
			 * but doing so generates an error when evaluating assertions, so
			 * we instead revert to an empty function...
			 */

			assert_options(ASSERT_CALLBACK, function(){});

			self::$_enabled = false;
		}
	}
public static function enable ( $ state = true , $ enable_assert = false ) { $ state = ( bool ) $ state ; self :: enableAssert ( ( bool ) $ enable_assert ) ; if ( $ state && self :: $ _enabled || ! $ state && ! self :: $ _enabled ) { return ; } if ( $ state ) { set_exception_handler ( __CLASS__ . '::exception' ) ; set_error_handler ( __CLASS__ . '::error' , error_reporting ( ) ) ; assert_options ( ASSERT_CALLBACK , __CLASS__ . '::assert' ) ; self :: $ _enabled = true ; } else { restore_exception_handler ( ) ; restore_error_handler ( ) ; /*
			 * According to the PHP documentation this should reset to NULL,
			 * but doing so generates an error when evaluating assertions, so
			 * we instead revert to an empty function...
			 */ assert_options ( ASSERT_CALLBACK , function ( ) { } ) ; self :: $ _enabled = false ; } }
Enable all custom error-, exception- and assert-handling.

<p>This overwrites the built-in exception-handling, error-handling and
assert logic with the ones provided by the Framework (c.q. as defined in
this file). The optional argument {@link $state} can be used to
revert back to the previous (c.q. built-in) handlers.</p>

<p><strong>Note:</strong> Repeated calls to this method have no effect;
once enabled it will not re-enable (to ensure the previous handlers can
be consistently restored). If other parts of the code start messing with
the error-handling you're on your own though...<br>
<strong>N.B.</strong>: The {@link $enable_assert} parameter <em>is</em>
processed during repeat-calls to this method, so it is possible to
repeatedly change assert()-evaluation via this method (even though
calling {@link ExceptionHandler::enableAssert()} directly is the
recommended way).</p>

@param boolean $state
@param boolean $enable_assert
@return void
@uses ExceptionHandler::enableAssert()
Enable all custom error - exception - and assert - handling .