Conditions | 4 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public function output(Collection $detectedQueries, Response $response) |
||
16 | { |
||
17 | if (stripos($response->headers->get('Content-Type'), 'text/html') !== 0 || $response->isRedirection()) { |
||
18 | return; |
||
19 | } |
||
20 | |||
21 | $content = $response->getContent(); |
||
22 | |||
23 | $outputContent = $this->getOutputContent($detectedQueries); |
||
24 | |||
25 | $pos = strripos($content, '</body>'); |
||
26 | |||
27 | if (false !== $pos) { |
||
28 | $content = substr($content, 0, $pos) . $outputContent . substr($content, $pos); |
||
29 | } else { |
||
30 | $content = $content . $outputContent; |
||
31 | } |
||
32 | |||
33 | // Update the new content and reset the content length |
||
34 | $response->setContent($content); |
||
35 | |||
36 | $response->headers->remove('Content-Length'); |
||
37 | } |
||
54 |