/** * @param \Symfony\Component\HttpFoundation\Response $response * @param string $xhprofRunId */ protected function injectLink(Response $response, $xhprofRunId) { $content = $response->getContent(); $pos = mb_strripos($content, '</body>'); if (FALSE !== $pos) { $output = '<div class="xhprof-ui">' . $this->profiler->link($xhprofRunId) . '</div>'; $content = mb_substr($content, 0, $pos) . $output . mb_substr($content, $pos); $response->setContent($content); } }