Completed
Push — develop ( d114fd...73c793 )
by Abdelrahman
16:17
created

DatabaseSessionHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 18
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
     * @return $this
17
     */
18
    protected function addUserInformation(&$payload)
19
    {
20
        if ($this->container->bound(Guard::class)) {
21
            $payload['user_id'] = $this->userId();
22
            $payload['user_type'] = ($user = $this->container->make(Guard::class)->user()) ? $user->getMorphClass() : null;
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 123 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
23
        }
24
25
        return $this;
26
    }
27
}
28