src/Components/LiteErrorHandler.php
public function register()
    {
        $that = $this;
        set_error_handler(function ($errno, $errstr, $errfile, $errline) use ($that) {
            if (!($errno & error_reporting())) {
                return;
            }

            $options = [
                'type' => $errno,
                'message' => $errstr,
                'file' => $errfile,
                'line' => $errline,
                'isError' => true,
            ];
            $that->handle(new ErrorPayload($options));
        });

        set_exception_handler(function ($e) use ($that) {
            /** @var \Exception|\Error $e */
            $options = [
                'type' => $e->getCode(),
                'message' => $e->getMessage(),
                'file' => $e->getFile(),
                'line' => $e->getLine(),
                'isException' => true,
                'exception' => $e,
            ];
            $that->handle(new ErrorPayload($options));
        });

        register_shutdown_function(function () use ($that) {
            if (null !== ($options = error_get_last())) {
                $that->handle(new ErrorPayload($options));
            }
        });
    }
public function register()
    {
        $that = $this;
        set_error_handler(function ($errno, $errstr, $errfile, $errline) use ($that) {
            if (!($errno & error_reporting())) {
                return;
            }

            $options = [
                'type' => $errno,
                'message' => $errstr,
                'file' => $errfile,
                'line' => $errline,
                'isError' => true,
            ];
            $that->handle(new ErrorPayload($options));
        });

        set_exception_handler(function ($e) use ($that) {
            /** @var \Exception|\Error $e */
            $options = [
                'type' => $e->getCode(),
                'message' => $e->getMessage(),
                'file' => $e->getFile(),
                'line' => $e->getLine(),
                'isException' => true,
                'exception' => $e,
            ];
            $that->handle(new ErrorPayload($options));
        });

        register_shutdown_function(function () use ($that) {
            if (null !== ($options = error_get_last())) {
                $that->handle(new ErrorPayload($options));
            }
        });
    }
public function register ( ) { $ that = $ this ; set_error_handler ( function ( $ errno , $ errstr , $ errfile , $ errline ) use ( $ that ) { if ( ! ( $ errno & error_reporting ( ) ) ) { return ; } $ options = [ 'type' => $ errno , 'message' => $ errstr , 'file' => $ errfile , 'line' => $ errline , 'isError' => true , ] ; $ that -> handle ( new ErrorPayload ( $ options ) ) ; } ) ; set_exception_handler ( function ( $ e ) use ( $ that ) { /** @var \Exception|\Error $e */ $ options = [ 'type' => $ e -> getCode ( ) , 'message' => $ e -> getMessage ( ) , 'file' => $ e -> getFile ( ) , 'line' => $ e -> getLine ( ) , 'isException' => true , 'exception' => $ e , ] ; $ that -> handle ( new ErrorPayload ( $ options ) ) ; } ) ; register_shutdown_function ( function ( ) use ( $ that ) { if ( null !== ( $ options = error_get_last ( ) ) ) { $ that -> handle ( new ErrorPayload ( $ options ) ) ; } } ) ; }
Registers itself as error and exception handler.
Registers itself as error and exception handler .