| Conditions | 3 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php namespace App\Http\Middleware; |
||
| 12 | public function handle($request, Closure $next) |
||
| 13 | { |
||
| 14 | $response = $next($request); |
||
| 15 | |||
| 16 | if ($response instanceof RedirectResponse) { |
||
|
|
|||
| 17 | return $response; |
||
| 18 | } |
||
| 19 | |||
| 20 | $cacheDays = 182; //180 days minimum reccomended by SSL Labs |
||
| 21 | $maxAge = 60 * 60 * 24 * $cacheDays; |
||
| 22 | |||
| 23 | //Domains on which we want to serve the header |
||
| 24 | // be careful with this as it can't be undone |
||
| 25 | // the domain must always be available over https |
||
| 26 | $protectedHosts = ['monitor.vestd.com']; |
||
| 27 | |||
| 28 | if (in_array($request->getHttpHost(), $protectedHosts)) { |
||
| 29 | return $response->header('Strict-Transport-Security', 'max-age=' . $maxAge . '; preload'); |
||
| 30 | } |
||
| 31 | |||
| 32 | return $response; |
||
| 33 | } |
||
| 34 | } |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.jsonfile (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.jsonto be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
requireorrequire-devsection?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceofchecks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.