Completed
Pull Request — master (#478)
by Luc
02:08
created

SubEventStatusUpdated::getReason()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace CultuurNet\UDB3\Event\Events\Status;
6
7
use Broadway\Serializer\SerializableInterface;
8
use CultuurNet\UDB3\Timestamp;
9
10
abstract class SubEventStatusUpdated implements SerializableInterface
11
{
12
    /**
13
     * @var string
14
     */
15
    private $eventId;
16
17
    /**
18
     * @var Timestamp
19
     */
20
    private $timestamp;
21
22
    /**
23
     * @var string
24
     */
25
    private $reason;
26
27
    final public function __construct(string $eventId, Timestamp $timestamp, string $reason)
28
    {
29
        $this->eventId = $eventId;
30
        $this->timestamp = $timestamp;
31
        $this->reason = $reason;
32
    }
33
34
    public function serialize(): array
35
    {
36
        return [
37
            'eventId' => $this->eventId,
38
            'timestamp' => $this->timestamp->serialize(),
39
            'reason' => $this->reason,
40
        ];
41
    }
42
43
    /**
44
     * @return static
45
     */
46
    public static function deserialize(array $data)
47
    {
48
        return new static(
49
            $data['eventId'],
50
            Timestamp::deserialize($data['timestamp']),
51
            $data['reason']
52
        );
53
    }
54
55
    public function getEventId(): string
56
    {
57
        return $this->eventId;
58
    }
59
60
    public function getTimestamp(): Timestamp
61
    {
62
        return $this->timestamp;
63
    }
64
65
    public function getReason(): string
66
    {
67
        return $this->reason;
68
    }
69
}
70