SimpleEventStream   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 0
f 0
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getIterator() 0 3 1
1
<?php declare(strict_types=1);
2
namespace Kepawni\Twilted\Basic;
3
4
use ArrayIterator;
5
use Kepawni\Twilted\DomainEvent;
6
use Kepawni\Twilted\EventStream;
7
use Traversable;
8
9
class SimpleEventStream implements EventStream
10
{
11
    private $events;
12
13
    /**
14
     * SimpleEventStream constructor.
15
     *
16
     * @param DomainEvent[] $events
17
     */
18
    public function __construct(array $events)
19
    {
20
        $this->events = $events;
21
    }
22
23
    /**
24
     * @return Traversable|DomainEvent[]
25
     */
26
    public function getIterator(): Traversable
27
    {
28
        return new ArrayIterator($this->events);
29
    }
30
}
31