Completed
Pull Request — master (#321)
by
unknown
04:34
created

AbstractTitleUpdated   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
lcom 1
cbo 2
dl 0
loc 44
rs 10
c 0
b 0
f 0

4 Methods

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