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;
		}
	}