Code Duplication    Length = 11-11 lines in 2 locations

src/DummyUser/DummyUserServiceProvider.php 2 locations

@@ 21-31 (lines=11) @@
18
            /** @var \Illuminate\Contracts\Cache\Repository $cache */
19
            $cache = $app->make(CacheContract::class);
20
21
            $this->app['events']->listen(Login::class, function ($event) use ($config, $cache) {
22
                if (! $event->user instanceof Authenticatable) {
23
                    return false;
24
                }
25
26
                $id = $event->user->id;
27
                if (! $id) {
28
                    return false;
29
                }
30
                $cache->put('users.' . $id, $event->user, $config['lifetime']);
31
            });
32
33
            $this->app['events']->listen(Logout::class, function ($event) use ($config, $cache) {
34
                if (! $event->user instanceof Authenticatable) {
@@ 33-43 (lines=11) @@
30
                $cache->put('users.' . $id, $event->user, $config['lifetime']);
31
            });
32
33
            $this->app['events']->listen(Logout::class, function ($event) use ($config, $cache) {
34
                if (! $event->user instanceof Authenticatable) {
35
                    return false;
36
                }
37
38
                $id = $event->user->id;
39
                if (! $id) {
40
                    return false;
41
                }
42
                $cache->forget('users.' . $id);
43
            });
44
45
            return new DummyUserProvider($cache, $config);
46
        });