Total Complexity | 9 |
Total Lines | 72 |
Duplicated Lines | 0 % |
Coverage | 80.95% |
Changes | 0 |
1 | <?php |
||
9 | class ExchangeCollection implements \Iterator, \Countable |
||
10 | { |
||
11 | /** |
||
12 | * @var \Xervice\RabbitMQ\Business\Dependency\Exchange\ExchangeInterface[] |
||
13 | */ |
||
14 | private $collection; |
||
15 | |||
16 | /** |
||
17 | * @var int |
||
18 | */ |
||
19 | private $position; |
||
20 | |||
21 | /** |
||
22 | * Collection constructor. |
||
23 | * |
||
24 | * @param \Xervice\RabbitMQ\Business\Dependency\Exchange\ExchangeInterface[] $collection |
||
25 | */ |
||
26 | 1 | public function __construct(array $collection) |
|
27 | { |
||
28 | 1 | foreach ($collection as $validator) { |
|
29 | 1 | $this->add($validator); |
|
30 | } |
||
31 | 1 | } |
|
32 | |||
33 | /** |
||
34 | * @param \Xervice\RabbitMQ\Business\Dependency\Exchange\ExchangeInterface $validator |
||
35 | */ |
||
36 | 1 | public function add(ExchangeInterface $validator): void |
|
37 | { |
||
38 | 1 | $this->collection[] = $validator; |
|
39 | 1 | } |
|
40 | |||
41 | /** |
||
42 | * @return \Xervice\RabbitMQ\Business\Dependency\Exchange\ExchangeInterface |
||
43 | */ |
||
44 | 2 | public function current(): ExchangeInterface |
|
47 | } |
||
48 | |||
49 | 2 | public function next(): void |
|
50 | { |
||
51 | 2 | $this->position++; |
|
52 | 2 | } |
|
53 | |||
54 | /** |
||
55 | * @return int |
||
56 | */ |
||
57 | public function key(): int |
||
58 | { |
||
59 | return $this->position; |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * @return bool |
||
64 | */ |
||
65 | 2 | public function valid(): bool |
|
66 | { |
||
67 | 2 | return isset($this->collection[$this->position]); |
|
68 | } |
||
69 | |||
70 | 2 | public function rewind(): void |
|
73 | 2 | } |
|
74 | |||
75 | /** |
||
76 | * @return int |
||
77 | */ |
||
78 | public function count(): int |
||
81 | } |
||
82 | } |