Completed
Push — master ( b6d9d8...5df2ff )
by Marceau
05:05
created

AuthCheckerSubscriber   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 22
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A subscribe() 0 4 1
A onUserLogin() 0 6 1
1
<?php
2
3
namespace Lab404\AuthChecker\Subscribers;
4
5
use Illuminate\Auth\Events\Login;
6
use Illuminate\Events\Dispatcher;
7
use Lab404\AuthChecker\Services\AuthChecker;
8
9
class AuthCheckerSubscriber
10
{
11
    /**
12
     * @param   Dispatcher $events
13
     * @return  void
14
     */
15
    public function subscribe($events)
16
    {
17
        $events->listen(Login::class, [$this, 'onUserLogin']);
18
    }
19
20
    /**
21
     * @param   Login $event
22
     * @return  void
23
     */
24
    public function onUserLogin(Login $event)
25
    {
26
        /** @var AuthChecker $manager */
27
        $manager = app('authchecker');
28
        $manager->handleLogin($event->user);
29
    }
30
}
31