Total Complexity | 9 |
Total Lines | 72 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | <?php |
||
9 | class QueueCollection implements \Iterator, \Countable |
||
10 | { |
||
11 | /** |
||
12 | * @var \Xervice\RabbitMQ\Business\Dependency\Queue\QueueInterface[] |
||
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\Queue\QueueInterface[] $collection |
||
25 | */ |
||
26 | public function __construct(array $collection) |
||
27 | { |
||
28 | foreach ($collection as $validator) { |
||
29 | $this->add($validator); |
||
30 | } |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param \Xervice\RabbitMQ\Business\Dependency\Queue\QueueInterface $validator |
||
35 | */ |
||
36 | public function add(QueueInterface $validator): void |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @return \Xervice\RabbitMQ\Business\Dependency\Queue\QueueInterface |
||
43 | */ |
||
44 | public function current(): QueueInterface |
||
45 | { |
||
46 | return $this->collection[$this->position]; |
||
47 | } |
||
48 | |||
49 | public function next(): void |
||
50 | { |
||
51 | $this->position++; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @return int |
||
56 | */ |
||
57 | public function key(): int |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * @return bool |
||
64 | */ |
||
65 | public function valid(): bool |
||
68 | } |
||
69 | |||
70 | public function rewind(): void |
||
71 | { |
||
72 | $this->position = 0; |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * @return int |
||
77 | */ |
||
78 | public function count(): int |
||
81 | } |
||
82 | } |