Completed
Pull Request — master (#66)
by Frank
07:06 queued 04:59
created

Snapshot   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 40
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A aggregateRootId() 0 3 1
A __construct() 0 8 1
A state() 0 3 1
A aggregateRootVersion() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EventSauce\EventSourcing\Snapshotting;
6
7
use EventSauce\EventSourcing\AggregateRootId;
8
9
final class Snapshot
10
{
11
    /**
12
     * @var AggregateRootId
13
     */
14
    private $aggregateRootId;
15
16
    /**
17
     * @var int
18
     */
19
    private $aggregateRootVersion;
20
21
    /**
22
     * @var mixed
23
     */
24
    private $state;
25
26
    public function __construct(
27
        AggregateRootId $aggregateRootId,
28
        int $aggregateRootVersion,
29
        $state
30
    ) {
31
        $this->aggregateRootId = $aggregateRootId;
32
        $this->aggregateRootVersion = $aggregateRootVersion;
33
        $this->state = $state;
34
    }
35
36
    public function aggregateRootId(): AggregateRootId
37
    {
38
        return $this->aggregateRootId;
39
    }
40
41
    public function aggregateRootVersion(): int
42
    {
43
        return $this->aggregateRootVersion;
44
    }
45
46
    public function state()
47
    {
48
        return $this->state;
49
    }
50
}
51