AggregateClosed   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 46
ccs 6
cts 6
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
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\Contract;
14
15
use ServiceBus\EventSourcing\AggregateId;
16
17
/**
18
 * The aggregate (event stream) was marked as closed for modification.
19
 *
20
 * @psalm-immutable
21
 */
22
final class AggregateClosed
23
{
24
    /**
25
     * Aggregate identifier.
26
     *
27
     * @var string
28
     */
29
    public $id;
30
31
    /**
32
     * Aggregate identifier class.
33
     *
34
     * @psalm-var class-string<\ServiceBus\EventSourcing\AggregateId>
35
     *
36
     * @var string
37
     */
38
    public $idClass;
39
40
    /**
41
     * Aggregate class.
42
     *
43
     * @psalm-var class-string<\ServiceBus\EventSourcing\Aggregate>
44
     *
45
     * @var string
46
     */
47
    public $aggregateClass;
48
49
    /**
50
     * Operation datetime.
51
     *
52
     * @var \DateTimeImmutable
53
     */
54
    public $datetime;
55
56
    /**
57
     * @psalm-param class-string<\ServiceBus\EventSourcing\Aggregate> $aggregateClass
58
     */
59 1
    public function __construct(AggregateId $id, string $aggregateClass, \DateTimeImmutable $datetime)
60
    {
61
        /** @psalm-var class-string<\ServiceBus\EventSourcing\AggregateId> $idClass */
62 1
        $idClass = (string) \get_class($id);
63
64 1
        $this->id             = $id->toString();
65 1
        $this->idClass        = $idClass;
66 1
        $this->aggregateClass = $aggregateClass;
67 1
        $this->datetime       = $datetime;
68 1
    }
69
}
70