EventAbstract   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 10
c 1
b 0
f 0
dl 0
loc 63
ccs 10
cts 10
cp 1
rs 10

4 Methods

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