public function injectDebugBar(ResponseInterface $response)
    {
        $content = $response->getContent();

        $renderer = $this->getJavascriptRenderer();
        $renderedContent = $this->generateAssetsContent().$renderer->render();

        $pos = strripos($content, '</body>');
        if (false !== $pos) {
            $content = substr($content, 0, $pos).$renderedContent.substr($content, $pos);
        } else {
            $content = '<body>'.$content.'</body>'.$renderedContent;
        }
        // Update the new content and reset the content length
        $response->setContent($content);
        $response->headers->remove('Content-Length');
    }
public function injectDebugBar(ResponseInterface $response)
    {
        $content = $response->getContent();

        $renderer = $this->getJavascriptRenderer();
        $renderedContent = $this->generateAssetsContent().$renderer->render();

        $pos = strripos($content, '</body>');
        if (false !== $pos) {
            $content = substr($content, 0, $pos).$renderedContent.substr($content, $pos);
        } else {
            $content = '<body>'.$content.'</body>'.$renderedContent;
        }
        // Update the new content and reset the content length
        $response->setContent($content);
        $response->headers->remove('Content-Length');
    }
public function injectDebugBar ( ResponseInterface $ response ) { $ content = $ response -> getContent ( ) ; $ renderer = $ this -> getJavascriptRenderer ( ) ; $ renderedContent = $ this -> generateAssetsContent ( ) . $ renderer -> render ( ) ; $ pos = strripos ( $ content , '</body>' ) ; if ( false !== $ pos ) { $ content = substr ( $ content , 0 , $ pos ) . $ renderedContent . substr ( $ content , $ pos ) ; } else { $ content = '<body>' . $ content . '</body>' . $ renderedContent ; } // Update the new content and reset the content length $ response -> setContent ( $ content ) ; $ response -> headers -> remove ( 'Content-Length' ) ; }
Injects the web debug toolbar
@param Response $response
Injects the web debug toolbar