SimpleEventStream::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 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