public static function register(interfaces\handlers\Error $handler = null, int $threshold = null)
    {
        // Use the given handler or instantiate a new one?
        $handler = $handler ?: new static($threshold);

        // Note: Utilizing the error_types parameter of set_error_handler would probably simplify this handler
        // a little bit (and make it perform better due to a cutdown on error_reporting() calls in cases with
        // lots of errors reported but ignored here due to being below threshold) but setting the threshold
        // on the fly would become unpredictable.
        set_error_handler([$handler, 'handle']);

        if ($handler instanceof interfaces\handlers\Shutdown) {
            register_shutdown_function([$handler, 'onShutdown']);
        }

        return $handler;
    }