protected function XHProfEventSubscriber::injectLink in XHProf 8
Adds link to view report to the end of the response.
Parameters
\Symfony\Component\HttpFoundation\Response $response: The response.
string $xhprofRunId: The run ID.
1 call to XHProfEventSubscriber::injectLink()
- XHProfEventSubscriber::onKernelResponse in src/
EventSubscriber/ XHProfEventSubscriber.php - Renders link to the finished run.
File
- src/
EventSubscriber/ XHProfEventSubscriber.php, line 143
Class
- XHProfEventSubscriber
- Provides handling of start/stop for profiler.
Namespace
Drupal\xhprof\EventSubscriberCode
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);
}
}