Completed
Pull Request — master (#414)
by
unknown
03:33
created

MarkedAsCanonical::deserialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace CultuurNet\UDB3\Place\Events;
4
5
use CultuurNet\UDB3\Place\PlaceEvent;
6
7
final class MarkedAsCanonical extends PlaceEvent
8
{
9
    /**
10
     * @var string
11
     */
12
    private $duplicatedBy;
13
14
    public function __construct(string $placeId, string $duplicatedBy)
15
    {
16
        parent::__construct($placeId);
17
        $this->duplicatedBy = $duplicatedBy;
18
    }
19
20
    public function getDuplicatedBy(): string
21
    {
22
        return $this->duplicatedBy;
23
    }
24
25
    public function serialize()
26
    {
27
        return parent::serialize() + [
28
                'duplicated_by' => $this->duplicatedBy,
29
            ];
30
    }
31
32
    public static function deserialize(array $data)
33
    {
34
        return new static($data['place_id'], ($data['duplicated_by']));
35
    }
36
}
37