DatabaseSessionHandler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A addUserInformation() 0 9 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Foundation\Overrides\Illuminate\Session;
6
7
use Illuminate\Contracts\Auth\Guard;
8
use Illuminate\Session\DatabaseSessionHandler as BaseDatabaseSessionHandler;
9
10
class DatabaseSessionHandler extends BaseDatabaseSessionHandler
11
{
12
    /**
13
     * Add the user information to the session payload.
14
     *
15
     * @param array $payload
16
     *
17
     * @return $this
18
     */
19
    protected function addUserInformation(&$payload)
20
    {
21
        if ($this->container->bound(Guard::class)) {
22
            $payload['user_id'] = $this->userId();
23
            $payload['user_type'] = ($user = $this->container->make(Guard::class)->user()) ? $user->getMorphClass() : null;
24
        }
25
26
        return $this;
27
    }
28
}
29