These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace JwPersistentUser; |
||
4 | |||
5 | use JwPersistentUser\Listener\WriteTokenToCookie, |
||
6 | JwPersistentUser\Service\CookieAuthenticationService; |
||
7 | |||
8 | use Zend\ModuleManager\Feature, |
||
9 | Zend\EventManager\EventManager, |
||
10 | Zend\EventManager\EventInterface; |
||
11 | use Zend\ServiceManager\ServiceManager; |
||
12 | |||
13 | class Module implements |
||
14 | Feature\ConfigProviderInterface, |
||
15 | Feature\BootstrapListenerInterface, |
||
16 | Feature\AutoloaderProviderInterface |
||
17 | { |
||
18 | public function getConfig() |
||
19 | { |
||
20 | return include __DIR__ . '/config/module.config.php'; |
||
21 | } |
||
22 | |||
23 | public function onBootstrap(EventInterface $e) |
||
24 | { |
||
25 | /** @var EventManager $em */ |
||
26 | $em = $e->getApplication()->getEventManager(); |
||
0 ignored issues
–
show
|
|||
27 | |||
28 | /** @var ServiceManager $sm */ |
||
29 | $sm = $e->getApplication()->getServiceManager(); |
||
30 | |||
31 | $request = $e->getApplication()->getRequest(); |
||
32 | $response = $e->getApplication()->getResponse(); |
||
33 | |||
34 | // Try to login from Cookie if applicable |
||
35 | $service = new CookieAuthenticationService($sm); |
||
36 | $service->loginFrom($request, $response); |
||
37 | } |
||
38 | |||
39 | public function getAutoloaderConfig() |
||
40 | { |
||
41 | return [ |
||
42 | 'Zend\Loader\StandardAutoloader' => [ |
||
43 | 'namespaces' => [ |
||
44 | __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, |
||
45 | ], |
||
46 | ], |
||
47 | ]; |
||
48 | } |
||
49 | } |
||
50 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.