Completed
Push — master ( 4803b3...959101 )
by Frank
03:46
created

DummyIncrementingHappened::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 3
1
<?php
2
3
namespace EventSauce\EventSourcing\Integration\TestingAggregates;
4
5
use EventSauce\EventSourcing\AggregateRootId;
6
use EventSauce\EventSourcing\Event;
7
use EventSauce\EventSourcing\PointInTime;
8
9
/**
10
 * @codeCoverageIgnore
11
 */
12
class DummyIncrementingHappened implements Event
13
{
14
    /**
15
     * @var AggregateRootId
16
     */
17
    private $aggregateRootId;
18
19
    /**
20
     * @var PointInTime
21
     */
22
    private $timeOfRecording;
23
24
    /**
25
     * @var int
26
     */
27
    private $number;
28
29
    public function __construct(AggregateRootId $aggregateRootId, PointInTime $timeOfRecording, int $number)
30
    {
31
        $this->aggregateRootId = $aggregateRootId;
32
        $this->timeOfRecording = $timeOfRecording;
33
        $this->number = $number;
34
    }
35
36
    public function aggregateRootId(): AggregateRootId
37
    {
38
        return $this->aggregateRootId;
39
    }
40
41
    public function eventVersion(): int
42
    {
43
        return 1;
44
    }
45
46
    public function timeOfRecording(): PointInTime
47
    {
48
        return $this->timeOfRecording;
49
    }
50
51
    public function toPayload(): array
52
    {
53
        return [];
54
    }
55
56
    public static function fromPayload(array $payload, AggregateRootId $aggregateRootId, PointInTime $timeOfRecording): Event
57
    {
58
        return new DummyIncrementingHappened($aggregateRootId, $timeOfRecording, $payload['number']);
59
    }
60
61
    public function number(): int
62
    {
63
        return $this->number;
64
    }
65
}