Completed
Pull Request — master (#33)
by Frank
06:20 queued 03:42
created

ReconstitutableAggregateRootFactory::__construct()   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 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EventSauce\EventSourcing;
6
7
use Generator;
8
9
class ReconstitutableAggregateRootFactory implements AggregateRootFactory
10
{
11
    /**
12
     * @var string
13
     */
14
    private $className;
15
16 10
    public function __construct(string $className)
17
    {
18 10
        $this->className = $className;
19 10
    }
20
21 8
    public function reconstituteFromEvents(AggregateRootId $aggregateRootId, Generator $events): AggregateRoot
22
    {
23
        /** @var ReconstitutableAggregateRoot $className */
24 8
        $className = $this->className;
25
26 8
        return $className::reconstituteFromEvents($aggregateRootId, $events);
27
    }
28
}
29