src/Http/ErrorHandling/Factory/WhoopsFactory.php
private function registerJsonHandler(Whoops $whoops, $config) : void
    {
        if (empty($config['json_exceptions']['display'])) {
            return;
        }

        $handler = new JsonResponseHandler();

        if (! empty($config['json_exceptions']['show_trace'])) {
            $handler->addTraceToOutput(true);
        }

        if (! empty($config['json_exceptions']['ajax_only'])) {
            if (\method_exists(WhoopsUtil::class, 'isAjaxRequest')) {
                // Whoops 2.x; don't push handler on stack unless we are in
                // an XHR request.
                if (! WhoopsUtil::isAjaxRequest()) {
                    return;
                }
            } elseif (\method_exists($handler, 'onlyForAjaxRequests')) {
                // Whoops 1.x
                $handler->onlyForAjaxRequests(true);
            }
        }

        $whoops->pushHandler($handler);
    }
private function registerJsonHandler(Whoops $whoops, $config) : void
    {
        if (empty($config['json_exceptions']['display'])) {
            return;
        }

        $handler = new JsonResponseHandler();

        if (! empty($config['json_exceptions']['show_trace'])) {
            $handler->addTraceToOutput(true);
        }

        if (! empty($config['json_exceptions']['ajax_only'])) {
            if (\method_exists(WhoopsUtil::class, 'isAjaxRequest')) {
                // Whoops 2.x; don't push handler on stack unless we are in
                // an XHR request.
                if (! WhoopsUtil::isAjaxRequest()) {
                    return;
                }
            } elseif (\method_exists($handler, 'onlyForAjaxRequests')) {
                // Whoops 1.x
                $handler->onlyForAjaxRequests(true);
            }
        }

        $whoops->pushHandler($handler);
    }
private function registerJsonHandler ( Whoops $ whoops , $ config ) : void { if ( empty ( $ config [ 'json_exceptions' ] [ 'display' ] ) ) { return ; } $ handler = new JsonResponseHandler ( ) ; if ( ! empty ( $ config [ 'json_exceptions' ] [ 'show_trace' ] ) ) { $ handler -> addTraceToOutput ( true ) ; } if ( ! empty ( $ config [ 'json_exceptions' ] [ 'ajax_only' ] ) ) { if ( \ method_exists ( WhoopsUtil :: class , 'isAjaxRequest' ) ) { // Whoops 2.x; don't push handler on stack unless we are in // an XHR request. if ( ! WhoopsUtil :: isAjaxRequest ( ) ) { return ; } } elseif ( \ method_exists ( $ handler , 'onlyForAjaxRequests' ) ) { // Whoops 1.x $ handler -> onlyForAjaxRequests ( true ) ; } } $ whoops -> pushHandler ( $ handler ) ; }
If configuration indicates a JsonResponseHandler, configure and register it.

@param Whoops $whoops
@param array|\ArrayAccess $config
@return void
If configuration indicates a JsonResponseHandler configure and register it .