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

ProcessorsRegistry::add()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
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