protected function prepareObResponse(Request $request)
    {
        ob_start();

        // handle request with laravel or lumen
        $response = $this->handleRequest($request);

        // prepare content for ob
        $content = '';
        $isFile = false;
        if ($isStream = $response instanceof StreamedResponse) {
            $response->sendContent();
        } elseif ($response instanceof SymfonyResponse) {
            $content = $response->getContent();
        } elseif (! $isFile = $response instanceof BinaryFileResponse) {
            $content = (string) $response;
        }

        // process terminating logics
        $this->terminate($request, $response);

        // append ob content to response
        if (! $isFile && ob_get_length() > 0) {
            if ($isStream) {
                $response->output = ob_get_contents();
            } else {
                $response->setContent(ob_get_contents() . $content);
            }
        }

        ob_end_clean();

        return $response;
    }
protected function prepareObResponse(Request $request)
    {
        ob_start();

        // handle request with laravel or lumen
        $response = $this->handleRequest($request);

        // prepare content for ob
        $content = '';
        $isFile = false;
        if ($isStream = $response instanceof StreamedResponse) {
            $response->sendContent();
        } elseif ($response instanceof SymfonyResponse) {
            $content = $response->getContent();
        } elseif (! $isFile = $response instanceof BinaryFileResponse) {
            $content = (string) $response;
        }

        // process terminating logics
        $this->terminate($request, $response);

        // append ob content to response
        if (! $isFile && ob_get_length() > 0) {
            if ($isStream) {
                $response->output = ob_get_contents();
            } else {
                $response->setContent(ob_get_contents() . $content);
            }
        }

        ob_end_clean();

        return $response;
    }
protected function prepareObResponse ( Request $ request ) { ob_start ( ) ; // handle request with laravel or lumen $ response = $ this -> handleRequest ( $ request ) ; // prepare content for ob $ content = '' ; $ isFile = false ; if ( $ isStream = $ response instanceof StreamedResponse ) { $ response -> sendContent ( ) ; } elseif ( $ response instanceof SymfonyResponse ) { $ content = $ response -> getContent ( ) ; } elseif ( ! $ isFile = $ response instanceof BinaryFileResponse ) { $ content = ( string ) $ response ; } // process terminating logics $ this -> terminate ( $ request , $ response ) ; // append ob content to response if ( ! $ isFile && ob_get_length ( ) > 0 ) { if ( $ isStream ) { $ response -> output = ob_get_contents ( ) ; } else { $ response -> setContent ( ob_get_contents ( ) . $ content ) ; } } ob_end_clean ( ) ; return $ response ; }
Handle request for ob output.

@param \Illuminate\Http\Request $request

@return \Illuminate\Http\Response
@throws \ReflectionException
Handle request for ob output .