| Conditions | 3 |
| Paths | 3 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | public function handle($request, Closure $next) |
||
| 39 | { |
||
| 40 | $response = $next($request); |
||
| 41 | |||
| 42 | if ($response instanceOf Response) { |
||
| 43 | $content = $response->getContent(); |
||
| 44 | |||
| 45 | $cookieConsentHTML = view('cookieConsent::index')->render(); |
||
| 46 | |||
| 47 | if (($bodyPosition = strripos($content, '</body>')) !== false) { |
||
| 48 | $content = '' |
||
| 49 | .substr($content, 0, $bodyPosition) |
||
| 50 | .$cookieConsentHTML |
||
| 51 | .substr($content, $bodyPosition); |
||
| 52 | } |
||
| 53 | |||
| 54 | $response->setContent($content); |
||
| 55 | } |
||
| 56 | |||
| 57 | return $response; |
||
| 58 | } |
||
| 59 | } |
||
| 60 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.