| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | private function inject(ResponseInterface $response, $code, $tag = 'body') |
||
| 25 | { |
||
| 26 | $html = (string) $response->getBody(); |
||
| 27 | $pos = strripos($html, "</{$tag}>"); |
||
| 28 | |||
| 29 | if ($pos === false) { |
||
| 30 | $response->getBody()->write($code); |
||
| 31 | |||
| 32 | return $response; |
||
| 33 | } |
||
| 34 | |||
| 35 | $body = Middleware::createStream(); |
||
| 36 | $body->write(substr($html, 0, $pos).$code.substr($html, $pos + 1)); |
||
| 37 | |||
| 38 | return $response->withBody($body); |
||
| 39 | } |
||
| 40 | |||
| 67 |