FireUserCreatedEventTask::run()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace App\Containers\User\Tasks;
4
5
use App\Containers\User\Events\Events\UserCreatedEvent;
6
use App\Ship\Parents\Actions\Action;
7
use Illuminate\Events\Dispatcher as EventsDispatcher;
8
9
/**
10
 * Class FireUserCreatedEventTask.
11
 *
12
 * @author Mahmoud Zalt <[email protected]>
13
 */
14
class FireUserCreatedEventTask extends Action
15
{
16
17
    /**
18
     * @var  \Illuminate\Events\Dispatcher
19
     */
20
    private $eventsDispatcher;
21
22
    /**
23
     * FireUserCreatedEventTask constructor.
24
     *
25
     * @param \Illuminate\Events\Dispatcher $eventsDispatcher
26
     */
27
    public function __construct(EventsDispatcher $eventsDispatcher)
28
    {
29
        $this->eventsDispatcher = $eventsDispatcher;
30
    }
31
32
    /**
33
     * @param $user
34
     *
35
     * @return  mixed
36
     */
37
    public function run($user)
38
    {
39
        // Dispatch a User Created Event
40
        $this->eventsDispatcher->dispatch(New UserCreatedEvent($user));
41
42
        return $user;
43
    }
44
}
45