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
        ));
    }