SimpleAggregateHistory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 0
f 0
dl 0
loc 22
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getIterator() 0 3 1
A __construct() 0 4 1
A getId() 0 3 1
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