public function injectToolbarHtml(MvcEvent $event)
    {
        if (! $inspection = $event->getParam(ApplicationInspectorListener::PARAM_INSPECTION)) {
            return;
        }

        $response = $event->getResponse();

        if (! $response instanceof Response) {
            return;
        }

        $headers     = $response->getHeaders();
        $contentType = $headers->get('Content-Type');

        if ($contentType) {
            if (!$contentType instanceof ContentType) {
                return;
            }

            if (false === strpos(strtolower($contentType->getFieldValue()), 'html')) {
                return;
            }
        }

        $response->setContent(preg_replace(
            '/<\/body>/i',
            $this->renderer->render($this->inspectionRenderer->render($inspection)) . '</body>',
            $response->getContent(),
            1
        ));
    }
public function injectToolbarHtml(MvcEvent $event)
    {
        if (! $inspection = $event->getParam(ApplicationInspectorListener::PARAM_INSPECTION)) {
            return;
        }

        $response = $event->getResponse();

        if (! $response instanceof Response) {
            return;
        }

        $headers     = $response->getHeaders();
        $contentType = $headers->get('Content-Type');

        if ($contentType) {
            if (!$contentType instanceof ContentType) {
                return;
            }

            if (false === strpos(strtolower($contentType->getFieldValue()), 'html')) {
                return;
            }
        }

        $response->setContent(preg_replace(
            '/<\/body>/i',
            $this->renderer->render($this->inspectionRenderer->render($inspection)) . '</body>',
            $response->getContent(),
            1
        ));
    }
public function injectToolbarHtml ( MvcEvent $ event ) { if ( ! $ inspection = $ event -> getParam ( ApplicationInspectorListener :: PARAM_INSPECTION ) ) { return ; } $ response = $ event -> getResponse ( ) ; if ( ! $ response instanceof Response ) { return ; } $ headers = $ response -> getHeaders ( ) ; $ contentType = $ headers -> get ( 'Content-Type' ) ; if ( $ contentType ) { if ( ! $ contentType instanceof ContentType ) { return ; } if ( false === strpos ( strtolower ( $ contentType -> getFieldValue ( ) ) , 'html' ) ) { return ; } } $ response -> setContent ( preg_replace ( '/<\/body>/i' , $ this -> renderer -> render ( $ this -> inspectionRenderer -> render ( $ inspection ) ) . '</body>' , $ response -> getContent ( ) , 1 ) ) ; }
Attaches the HTML rendered for the toolbar to the output if the output is recognized as an HTML HTTP response

@param MvcEvent $event

@return void
Attaches the HTML rendered for the toolbar to the output if the output is recognized as an HTML HTTP response