Completed
Pull Request — master (#320)
by Luc
05:00
created

LocationUpdated::getLocationId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace CultuurNet\UDB3\Event\Events;
4
5
use CultuurNet\UDB3\Location\LocationId;
6
use CultuurNet\UDB3\Offer\Events\AbstractEvent;
7
8 View Code Duplication
class LocationUpdated extends AbstractEvent
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
{
10
    /**
11
     * @var LocationId
12
     */
13
    private $locationId;
14
15
    /**
16
     * @param string $eventId
17
     * @param LocationId $locationId
18
     */
19
    public function __construct(
20
        $eventId,
21
        LocationId $locationId
22
    ) {
23
        parent::__construct($eventId);
24
25
        $this->locationId = $locationId;
26
    }
27
28
    /**
29
     * @return LocationId
30
     */
31
    public function getLocationId()
32
    {
33
        return $this->locationId;
34
    }
35
36
    /**
37
     * @inheritdoc
38
     */
39
    public function serialize()
40
    {
41
        return parent::serialize() + [
42
                'location_id' => $this->locationId->toNative(),
43
            ];
44
    }
45
46
    /**
47
     * @inheritdoc
48
     */
49
    public static function deserialize(array $data)
50
    {
51
        return new static(
52
            $data['item_id'],
53
            new LocationId($data['location_id'])
54
        );
55
    }
56
}
57