UpdateSessionUser::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
ccs 6
cts 6
cp 1
cc 2
nc 2
nop 2
crap 2
1
<?php namespace JobApis\JobsToMail\Http\Middleware;
2
3
use Closure;
4
use JobApis\JobsToMail\Repositories\Contracts\UserRepositoryInterface;
5
6
class UpdateSessionUser
7
{
8
    /**
9
     * @var UserRepositoryInterface
10
     */
11
    public $users;
12
13
    /**
14
     * UpdateSessionUser constructor.
15
     *
16
     * @param UserRepositoryInterface $users
17
     */
18 2
    public function __construct(UserRepositoryInterface $users)
19
    {
20 2
        $this->users = $users;
21 2
    }
22
23
    /**
24
     * Run the request filter.
25
     *
26
     * @param  \Illuminate\Http\Request  $request
27
     * @param  \Closure  $next
28
     * @return mixed
29
     */
30 2
    public function handle($request, Closure $next)
31
    {
32 2
        if ($userId = $request->session()->get('user.id')) {
33
            // Update the user's session
34 1
            $request->session()->put(
0 ignored issues
show
Bug introduced by
The method put() does not seem to exist on object<Symfony\Component...ssion\SessionInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
35 1
                'user',
36 1
                $this->users->getById($userId)
37
            );
38
        }
39 2
        return $next($request);
40
    }
41
}
42