Completed
Push — master ( e28708...370080 )
by Marceau
01:48
created

SessionGuard::quietLogin()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 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