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

Events   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

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