Passed
Push — master ( a01adc...886b6f )
by Tomasz
01:40
created

CommandCollection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getIterator() 0 3 1
A __construct() 0 3 1
1
<?php
2
/**
3
 *
4
 * This file is part of the Aggrego.
5
 * (c) Tomasz Kunicki <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 */
11
12
declare(strict_types = 1);
13
14
namespace Aggrego\CommandLoginUnit\Shared\EventProcessor;
15
16
use Aggrego\CommandConsumer\Command;
17
use Aggrego\CommandLogicUnit\EventProcessor\CommandCollection as CommandCollectionInterface;
18
use ArrayIterator;
19
use Iterator;
20
use IteratorAggregate;
21
22
class CommandCollection implements IteratorAggregate, CommandCollectionInterface
23
{
24
    /**
25
     * @var Command[]
26
     */
27
    private $commands;
28
29
    public function __construct(Command ...$commands)
30
    {
31
        $this->commands = $commands;
32
    }
33
34
    public function getIterator(): Iterator
35
    {
36
        return new ArrayIterator($this->commands);
37
    }
38
}
39