EventUpdatedFromUDB2::serialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
dl 7
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace CultuurNet\UDB3\Event\Events;
4
5
use CultureFeed_Cdb_Xml;
6
use CultuurNet\UDB3\Event\EventEvent;
7
use CultuurNet\UDB3\HasCdbXmlTrait;
8
9 View Code Duplication
class EventUpdatedFromUDB2 extends EventEvent implements EventCdbXMLInterface
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...
10
{
11
    use HasCdbXmlTrait;
12
13
    public function __construct(string $eventId, string $cdbXml, string $cdbXmlNamespaceUri)
14
    {
15
        parent::__construct($eventId);
16
17
        $this->setCdbXml($cdbXml);
18
        $this->setCdbXmlNamespaceUri($cdbXmlNamespaceUri);
19
    }
20
21
    public function serialize(): array
22
    {
23
        return parent::serialize() + array(
24
            'cdbxml' => $this->getCdbXml(),
25
            'cdbXmlNamespaceUri' => $this->getCdbXmlNamespaceUri(),
26
        );
27
    }
28
29
    public static function deserialize(array $data): EventUpdatedFromUDB2
30
    {
31
        $data += array(
32
            'cdbXmlNamespaceUri' => CultureFeed_Cdb_Xml::namespaceUriForVersion('3.2'),
33
        );
34
        return new self(
35
            $data['event_id'],
36
            $data['cdbxml'],
37
            $data['cdbXmlNamespaceUri']
38
        );
39
    }
40
}
41