SetTheUserId   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 8 2
1
<?php
2
3
namespace Hechoenlaravel\JarvisFoundation\Notifications\SendAppNotification\Middleware;
4
5
use League\Tactician\Middleware;
6
7
class SetTheUserId implements Middleware
8
{
9
    /**
10
     * @param object $command
11
     * @param callable $next
12
     *
13
     * @return mixed
14
     */
15
    public function execute($command, callable $next)
16
    {
17
        $command->user_id = $command->user;
18
        if (is_object($command->user)) {
19
            $command->user_id = $command->user->id;
20
        }
21
        return $next($command);
22
    }
23
}
24