Completed
Push — master ( f8a5b0...9671c2 )
by Mahmoud
04:15
created

FireUserCreatedEventTask   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A run() 0 7 1
1
<?php
2
3
namespace App\Containers\User\Tasks;
4
5
use App\Containers\User\Events\Events\UserCreatedEvent;
6
use App\Port\Action\Abstracts\Action;
7
use App\Port\Event\Dispatcher\EventsDispatcher;
8
9
/**
10
 * Class FireUserCreatedEventTask.
11
 *
12
 * @author Mahmoud Zalt <[email protected]>
13
 */
14
class FireUserCreatedEventTask extends Action
15
{
16
17
    /**
18
     * @var  \App\Port\Event\Dispatcher\EventsDispatcher
19
     */
20
    private $eventsDispatcher;
21
22
    /**
23
     * FireUserCreatedEventTask constructor.
24
     *
25
     * @param \App\Port\Event\Dispatcher\EventsDispatcher $eventsDispatcher
26
     */
27
    public function __construct(
28
        EventsDispatcher $eventsDispatcher
29
    ) {
30
        $this->eventsDispatcher = $eventsDispatcher;
31
    }
32
33
    /**
34
     * @param $user
35
     *
36
     * @return  mixed
37
     */
38
    public function run($user)
39
    {
40
        // Fire a User Created Event
41
        $this->eventsDispatcher->fire(New UserCreatedEvent($user));
42
43
        return $user;
44
    }
45
}
46