Test Failed
Pull Request — master (#29)
by Frank
02:39
created

ConstructingEventSerializer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A serializeEvent() 0 5 1
A unserializePayload() 0 5 1
1
<?php
2
3
namespace EventSauce\EventSourcing\Serialization;
4
5
class ConstructingEventSerializer implements EventSerializer
6
{
7
    public function serializeEvent(object $event): array
8
    {
9
        /** @var $event SerializableEvent */
10
        return $event->toPayload();
11
    }
12
13
    public function unserializePayload(string $className, array $payload): object
14
    {
15
        /** @var $className SerializableEvent */
16
        return $className::fromPayload($payload);
17
    }
18
}