Passed
Push — master ( 2ee0d1...1e8995 )
by Tomasz
03:21
created

Events::add()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Aggrego\Domain\Api\Application\Event;
6
7
use ArrayIterator;
8
use Iterator;
9
use IteratorAggregate;
10
11
class Events implements IteratorAggregate
12
{
13
    /** @var array */
14
    private $list;
15
16
    public function __construct()
17
    {
18
        $this->list = [];
19
    }
20
21
    public function add(Event $event)
22
    {
23
        $this->list[] = $event;
24
    }
25
26
    public function getIterator(): Iterator
27
    {
28
        return new ArrayIterator($this->list);
29
    }
30
}
31