SessionGuard   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A quietLogin() 0 6 1
A quietLogout() 0 8 1
1
<?php
2
3
namespace Lab404\Impersonate\Guard;
4
5
use Illuminate\Auth\SessionGuard as BaseSessionGuard;
6
use Illuminate\Contracts\Auth\Authenticatable;
7
8
class SessionGuard extends BaseSessionGuard
9
{
10
    /**
11
     * Log a user into the application without firing the Login event.
12
     *
13
     * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
14
     * @return void
15
     */
16
    public function quietLogin(Authenticatable $user)
17
    {
18
        $this->updateSession($user->getAuthIdentifier());
19
20
        $this->setUser($user);
21
    }
22
23
    /**
24
     * Logout the user without updating remember_token
25
     * and without firing the Logout event.
26
     *
27
     * @param   void
28
     * @return  void
29
     */
30
    public function quietLogout()
31
    {
32
        $this->clearUserDataFromStorage();
33
34
        $this->user = null;
35
36
        $this->loggedOut = true;
37
    }
38
}
39