Passed
Pull Request — master (#33)
by Frank
05:08
created

reconstituteFromEvents()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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