src/ResponseErrorAbstract.php
protected function generateOutputHandler(
        ServerRequestInterface $request,
        ResponseInterface $response,
        \Throwable $e
    ) : ResponseInterface {

        $contentType = $this->getContentType();
        // if content type has not been set
        // get it from Request / Response
        if (!$contentType) {
            $contentType = $response->getHeaderLine('Content-Type')?: (
                $request->getHeaderLine('Content-Type')?: static::DEFAULT_CONTENT_TYPE
            );
            $this->setContentType($contentType);
        }

        $this->cleanOutputBuffer();
        $body = new RequestBody();

        $handler = $this->getOutputHandler($request, $response, $e);
        // disable quit
        $handler->allowQuit(false);
        // log
        $this->logThrowable($e);
        // write handler
        $body->write($handler->handleException($e));

        return $response->withBody($body)->withHeader('Content-Type', $contentType);
    }
protected function generateOutputHandler(
        ServerRequestInterface $request,
        ResponseInterface $response,
        \Throwable $e
    ) : ResponseInterface {

        $contentType = $this->getContentType();
        // if content type has not been set
        // get it from Request / Response
        if (!$contentType) {
            $contentType = $response->getHeaderLine('Content-Type')?: (
                $request->getHeaderLine('Content-Type')?: static::DEFAULT_CONTENT_TYPE
            );
            $this->setContentType($contentType);
        }

        $this->cleanOutputBuffer();
        $body = new RequestBody();

        $handler = $this->getOutputHandler($request, $response, $e);
        // disable quit
        $handler->allowQuit(false);
        // log
        $this->logThrowable($e);
        // write handler
        $body->write($handler->handleException($e));

        return $response->withBody($body)->withHeader('Content-Type', $contentType);
    }
protected function generateOutputHandler ( ServerRequestInterface $ request , ResponseInterface $ response , \ Throwable $ e ) : ResponseInterface { $ contentType = $ this -> getContentType ( ) ; // if content type has not been set // get it from Request / Response if ( ! $ contentType ) { $ contentType = $ response -> getHeaderLine ( 'Content-Type' ) ? : ( $ request -> getHeaderLine ( 'Content-Type' ) ? : static :: DEFAULT_CONTENT_TYPE ) ; $ this -> setContentType ( $ contentType ) ; } $ this -> cleanOutputBuffer ( ) ; $ body = new RequestBody ( ) ; $ handler = $ this -> getOutputHandler ( $ request , $ response , $ e ) ; // disable quit $ handler -> allowQuit ( false ) ; // log $ this -> logThrowable ( $ e ) ; // write handler $ body -> write ( $ handler -> handleException ( $ e ) ) ; return $ response -> withBody ( $ body ) -> withHeader ( 'Content-Type' , $ contentType ) ; }
Generate Output Handler For Response

@param ServerRequestInterface $request
@param ResponseInterface $response
@param \Throwable $e

@return ResponseInterface
Generate Output Handler For Response