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

ConstructingEventSerializer::serializeEvent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 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
}