Completed
Push — v4.0 ( 989be1...ff495d )
by Masiukevich
02:21
created

Snapshot::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
/**
4
 * Event Sourcing implementation.
5
 *
6
 * @author  Maksim Masiukevich <[email protected]>
7
 * @license MIT
8
 * @license https://opensource.org/licenses/MIT
9
 */
10
11
declare(strict_types = 1);
12
13
namespace ServiceBus\EventSourcing\Snapshots;
14
15
use ServiceBus\EventSourcing\Aggregate;
16
17
/**
18
 * @psalm-readonly
19
 */
20
final class Snapshot
21
{
22
    /**
23
     * Aggregate.
24
     *
25
     * @var Aggregate
26
     */
27
    public Aggregate $aggregate;
28
29
    /**
30
     * Aggregate version.
31
     *
32
     * @var int
33
     */
34
    public int $version;
35
36 7
    public function __construct(Aggregate $aggregate, int $version)
37
    {
38 7
        $this->aggregate = $aggregate;
39 7
        $this->version   = $version;
40 7
    }
41
}
42