Completed
Pull Request — master (#473)
by
unknown
02:11
created

AbstractEvent::deserialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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
    const UUID = 'uuid';
12
    const NAME = 'name';
13
14
    /**
15
     * @var UUID
16
     */
17
    private $uuid;
18
19
    /**
20
     * @var LabelName
21
     */
22
    private $name;
23
24
    /**
25
     * AbstractEvent constructor.
26
     * @param UUID $uuid
27
     * @param LabelName $name
28
     */
29
    public function __construct(UUID $uuid, LabelName $name)
30
    {
31
        $this->uuid = $uuid;
32
        $this->name = $name;
33
    }
34
35
    /**
36
     * @return UUID
37
     */
38
    public function getUuid()
39
    {
40
        return $this->uuid;
41
    }
42
43
    /**
44
     * @return LabelName
45
     */
46
    public function getName()
47
    {
48
        return $this->name;
49
    }
50
51
    /**
52
     * @inheritdoc
53
     */
54
    public function serialize()
55
    {
56
        return [
57
            self::UUID => $this->getUuid()->toNative(),
58
            self::NAME => $this->getName()->toNative(),
59
        ];
60
    }
61
}
62