| Conditions | 1 |
| Paths | 1 |
| Total Lines | 24 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function __invoke(ContainerInterface $container): JwtAuthMiddleware |
||
| 19 | { |
||
| 20 | $options = [ |
||
|
|
|||
| 21 | 'secure' => true, // Check for https |
||
| 22 | 'relaxed' => [], |
||
| 23 | 'signer' => new Sha256(), |
||
| 24 | 'privateKey' => 'private-key', // my super secret key |
||
| 25 | /* |
||
| 26 | 'jwtStorage' => [ |
||
| 27 | HttpCookieStorage::class => [ |
||
| 28 | 'name' => 'jwtcookie', |
||
| 29 | 'path' => '/', |
||
| 30 | //"httponly" => true, |
||
| 31 | //"secure" => true |
||
| 32 | ], |
||
| 33 | HttpAuthBearerStorage::class |
||
| 34 | ],*/ |
||
| 35 | 'attribute' => JwtAuthMiddleware::class, // request attribute |
||
| 36 | ]; |
||
| 37 | |||
| 38 | $jwtService = new JwtService(new Sha256(), 'private-key'); |
||
| 39 | |||
| 40 | return new JwtAuthMiddleware($jwtService); |
||
| 41 | } |
||
| 42 | } |
||
| 43 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.