SimpleAggregateHistory::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 2
1
<?php declare(strict_types=1);
2
namespace Kepawni\Twilted\Basic;
3
4
use Kepawni\Twilted\DomainEvent;
5
use Kepawni\Twilted\EntityHistory;
6
use Kepawni\Twilted\EntityIdentifier;
7
use Kepawni\Twilted\EventStream;
8
use Traversable;
9
10
class SimpleAggregateHistory implements EntityHistory
11
{
12
    private $events;
13
    private $id;
14
15
    public function __construct(EntityIdentifier $id, EventStream $events)
16
    {
17
        $this->id = $id;
18
        $this->events = $events;
19
    }
20
21
    public function getId(): EntityIdentifier
22
    {
23
        return $this->id;
24
    }
25
26
    /**
27
     * @return Traversable|DomainEvent[]
28
     */
29
    public function getIterator(): Traversable
30
    {
31
        return $this->events->getIterator();
32
    }
33
}
34