AbstractEvent   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 39
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getUuid() 0 4 1
A getName() 0 4 1
A serialize() 0 7 1
1
<?php
2
3
namespace CultuurNet\UDB3\Label\Events;
4
5
use Broadway\Serializer\SerializableInterface;
6
use CultuurNet\UDB3\Label\ValueObjects\LabelName;
7
use ValueObjects\Identity\UUID;
8
9
abstract class AbstractEvent implements SerializableInterface
10
{
11
    public const UUID = 'uuid';
12
    public const NAME = 'name';
13
14
    /**
15
     * @var UUID
16
     */
17
    private $uuid;
18
19
    /**
20
     * @var LabelName
21
     */
22
    private $name;
23
24
    public function __construct(UUID $uuid, LabelName $name)
25
    {
26
        $this->uuid = $uuid;
27
        $this->name = $name;
28
    }
29
30
    public function getUuid(): UUID
31
    {
32
        return $this->uuid;
33
    }
34
35
    public function getName(): LabelName
36
    {
37
        return $this->name;
38
    }
39
40
    public function serialize(): array
41
    {
42
        return [
43
            self::UUID => $this->getUuid()->toNative(),
44
            self::NAME => $this->getName()->toNative(),
45
        ];
46
    }
47
}
48