Completed
Push — master ( 5322e7...4643c4 )
by Pierre
03:00
created

EventAbstract::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 8
ccs 4
cts 4
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace App\Component\Pubsub;
4
5
class EventAbstract implements EventInterface
6
{
7
    /**
8
     * The name of the resource publishing this event
9
     * @var string
10
     */
11
    protected $resourceName;
12
13
    /**
14
     * The name of this event
15
     * @var string
16
     */
17
    protected $eventName;
18
19
    /**
20
     * Any data associated with this event
21
     * @var mixed
22
     */
23
    protected $datas;
24
25
    /**
26
     * @param string $resourceName  name of the publisher
27
     * @param string $eventName     name of the event
28
     * @param mixed $data           [OPTIONAL] Additional event data
29
     */
30 4
    public function __construct(
31
        string $resourceName,
32
        string $eventName,
33
        $datas = null
34
    ) {
35 4
        $this->resourceName = $resourceName;
36 4
        $this->eventName = $eventName;
37 4
        $this->datas = $datas;
38
    }
39
40
    /**
41
     * return the name of the event
42
     *
43
     * @return string
44
     */
45 1
    public function getEventName(): string
46
    {
47 1
        return $this->eventName;
48
    }
49
50
    /**
51
     * return the name of the resource
52
     *
53
     * @return string
54
     */
55 1
    public function getResourceName(): string
56
    {
57 1
        return $this->resourceName;
58
    }
59
60
    /**
61
     * return datas
62
     *
63
     * @return mixed
64
     */
65 1
    public function getDatas()
66
    {
67 1
        return $this->datas;
68
    }
69
}
70