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