SetTheUserId::execute()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 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