Completed
Push — master ( 17fbce...9c0ecb )
by Nikola
02:12
created

ProcessorsRegistry::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 0
cts 7
cp 0
rs 9.4286
cc 2
eloc 4
nc 2
nop 1
crap 6
1
<?php
2
3
namespace RunOpenCode\ExchangeRate\Registry;
4
5
use RunOpenCode\Backup\Contract\ProcessorInterface;
6
use RunOpenCode\ExchangeRate\Contract\ProcessorsRegistryInterface;
7
8
final class ProcessorsRegistry implements ProcessorsRegistryInterface
9
{
10
    private $processors;
11
12
    public function __construct(array $processors = array())
13
    {
14
        $this->processors = array();
15
16
        foreach ($processors as $processor) {
17
            $this->add($processor);
18
        }
19
    }
20
21
    public function add(ProcessorInterface $processor)
22
    {
23
        $this->processors[] = $processor;
24
    }
25
26
    public function all()
27
    {
28
        return $this->processors;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function getIterator()
35
    {
36
        return new \ArrayIterator($this->processors);
37
    }
38
}
39