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

DatabaseSessionHandler::addUserInformation()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

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