Completed
Pull Request — master (#309)
by Luc
08:47
created

AddressUpdated   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getAddress() 0 4 1
A serialize() 0 6 1
A deserialize() 0 4 1
1
<?php
2
3
namespace CultuurNet\UDB3\Place\Events;
4
5
use CultuurNet\UDB3\Address\Address;
6
use CultuurNet\UDB3\Place\PlaceEvent;
7
8
class AddressUpdated extends PlaceEvent
9
{
10
    /**
11
     * @var Address
12
     */
13
    private $address;
14
15
    /**
16
     * @param string $placeId
17
     * @param Address $address
18
     */
19
    public function __construct($placeId, Address $address)
20
    {
21
        parent::__construct($placeId);
22
        $this->address = $address;
23
    }
24
25
    /**
26
     * @return Address
27
     */
28
    public function getAddress()
29
    {
30
        return $this->address;
31
    }
32
33
    /**
34
     * @return array
35
     */
36
    public function serialize()
37
    {
38
        return parent::serialize() + [
39
            'address' => $this->address->serialize(),
40
        ];
41
    }
42
43
    /**
44
     * @param array $data
45
     * @return AddressUpdated
46
     */
47
    public static function deserialize(array $data)
48
    {
49
        return new static($data['place_id'], Address::deserialize($data['address']));
50
    }
51
}
52