| Conditions | 5 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function process(HTTPRequest $request, callable $delegate) |
||
| 31 | { |
||
| 32 | /** @var HTTPResponse $response */ |
||
| 33 | $response = $delegate($request); |
||
| 34 | |||
| 35 | $mime = $response->getHeader('Content-Type'); |
||
| 36 | |||
| 37 | if (!$mime || strpos($mime, 'text/html') !== false) { |
||
| 38 | $tags = $this->tagProvider->forTemplate(); |
||
| 39 | |||
| 40 | if ($tags && !static::$installed) { |
||
| 41 | $content = $response->getBody(); |
||
| 42 | $content = preg_replace("/(<\\/head[^>]*>)/i", $tags . "\\1", $content); |
||
| 43 | $response->setBody($content); |
||
| 44 | |||
| 45 | static::$installed = true; |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 49 | return $response; |
||
| 50 | } |
||
| 52 |