public function emitResponse(ServerRequestInterface $request, ResponseInterface $response)
    {
        try {
            $this->getResponseEmitter()->emit($response);
        } catch (\Exception $e) {
            if ($this->canForceResponseEmitting()) {
                // flush buffers
                $maxBufferLevel = ob_get_level();

                while (ob_get_level() > $maxBufferLevel) {
                    ob_end_flush();
                }

                // print response
                echo $response->getBody();
            } else {
                throw $e;
            }
        }
        $applicationEvent = $this->getApplicationEvent();
        $applicationEvent->setName(self::EVENT_RESPONSE_SENT);
        $applicationEvent->setRequest($request);
        $applicationEvent->setResponse($response);
        $this->emit($applicationEvent);
    }
public function emitResponse(ServerRequestInterface $request, ResponseInterface $response)
    {
        try {
            $this->getResponseEmitter()->emit($response);
        } catch (\Exception $e) {
            if ($this->canForceResponseEmitting()) {
                // flush buffers
                $maxBufferLevel = ob_get_level();

                while (ob_get_level() > $maxBufferLevel) {
                    ob_end_flush();
                }

                // print response
                echo $response->getBody();
            } else {
                throw $e;
            }
        }
        $applicationEvent = $this->getApplicationEvent();
        $applicationEvent->setName(self::EVENT_RESPONSE_SENT);
        $applicationEvent->setRequest($request);
        $applicationEvent->setResponse($response);
        $this->emit($applicationEvent);
    }
public function emitResponse ( ServerRequestInterface $ request , ResponseInterface $ response ) { try { $ this -> getResponseEmitter ( ) -> emit ( $ response ) ; } catch ( \ Exception $ e ) { if ( $ this -> canForceResponseEmitting ( ) ) { // flush buffers $ maxBufferLevel = ob_get_level ( ) ; while ( ob_get_level ( ) > $ maxBufferLevel ) { ob_end_flush ( ) ; } // print response echo $ response -> getBody ( ) ; } else { throw $ e ; } } $ applicationEvent = $ this -> getApplicationEvent ( ) ; $ applicationEvent -> setName ( self :: EVENT_RESPONSE_SENT ) ; $ applicationEvent -> setRequest ( $ request ) ; $ applicationEvent -> setResponse ( $ response ) ; $ this -> emit ( $ applicationEvent ) ; }
Emit a response

@param \Psr\Http\Message\ServerRequestInterface $request
@param \Psr\Http\Message\ResponseInterface $response
@throws \Exception
Emit a response