protected function handleRequest(
        ServerRequestInterface $serverRequest,
        ?EventManagerContract $events
    ): ResponseInterface {
        try {
            if ($events !== null) {
                $events->trigger(new KernelFinishRequestEvent($this, $serverRequest));
            }

            $response = $this->sendRequestThroughRouter($serverRequest);
        } catch (Throwable $exception) {
            $this->reportException($exception);

            $response = $this->renderException($serverRequest, $exception);

            if ($events !== null) {
                $events->trigger(new KernelExceptionEvent($this, $serverRequest, $response));
            }
        }

        return $response;
    }
protected function handleRequest(
        ServerRequestInterface $serverRequest,
        ?EventManagerContract $events
    ): ResponseInterface {
        try {
            if ($events !== null) {
                $events->trigger(new KernelFinishRequestEvent($this, $serverRequest));
            }

            $response = $this->sendRequestThroughRouter($serverRequest);
        } catch (Throwable $exception) {
            $this->reportException($exception);

            $response = $this->renderException($serverRequest, $exception);

            if ($events !== null) {
                $events->trigger(new KernelExceptionEvent($this, $serverRequest, $response));
            }
        }

        return $response;
    }
protected function handleRequest ( ServerRequestInterface $ serverRequest , ? EventManagerContract $ events ) : ResponseInterface { try { if ( $ events !== null ) { $ events -> trigger ( new KernelFinishRequestEvent ( $ this , $ serverRequest ) ) ; } $ response = $ this -> sendRequestThroughRouter ( $ serverRequest ) ; } catch ( Throwable $ exception ) { $ this -> reportException ( $ exception ) ; $ response = $ this -> renderException ( $ serverRequest , $ exception ) ; if ( $ events !== null ) { $ events -> trigger ( new KernelExceptionEvent ( $ this , $ serverRequest , $ response ) ) ; } } return $ response ; }
Convert request into response.

@param \Psr\Http\Message\ServerRequestInterface             $serverRequest
@param null|\Viserio\Component\Contract\Events\EventManager $events

@return \Psr\Http\Message\ResponseInterface
Convert request into response .