Total Complexity | 8 |
Total Lines | 65 |
Duplicated Lines | 0 % |
Coverage | 78.95% |
Changes | 0 |
1 | <?php |
||
6 | class TransactionCollection implements \Iterator, \Countable |
||
7 | { |
||
8 | /** |
||
9 | * @var \Xervice\Redis\Business\Model\Transaction\TransactionInterface[] |
||
10 | */ |
||
11 | private $collection = []; |
||
12 | |||
13 | /** |
||
14 | * @var int |
||
15 | */ |
||
16 | private $position; |
||
17 | |||
18 | /** |
||
19 | * @param \Xervice\Redis\Business\Model\Transaction\TransactionInterface $validator |
||
20 | */ |
||
21 | 1 | public function add(TransactionInterface $validator) |
|
22 | { |
||
23 | 1 | $this->collection[] = $validator; |
|
24 | 1 | } |
|
25 | |||
26 | /** |
||
27 | * @return \Xervice\Redis\Business\Model\Transaction\TransactionInterface |
||
28 | */ |
||
29 | 1 | public function current(): TransactionInterface |
|
30 | { |
||
31 | 1 | return $this->collection[$this->position]; |
|
32 | } |
||
33 | |||
34 | 1 | public function next(): void |
|
35 | { |
||
36 | 1 | $this->position++; |
|
37 | 1 | } |
|
38 | |||
39 | /** |
||
40 | * @return int |
||
41 | */ |
||
42 | public function key(): int |
||
43 | { |
||
44 | return $this->position; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @return bool |
||
49 | */ |
||
50 | 1 | public function valid(): bool |
|
51 | { |
||
52 | 1 | return isset($this->collection[$this->position]); |
|
53 | } |
||
54 | |||
55 | 1 | public function rewind(): void |
|
56 | { |
||
57 | 1 | $this->position = 0; |
|
58 | 1 | } |
|
59 | |||
60 | /** |
||
61 | * @return int |
||
62 | */ |
||
63 | public function count(): int |
||
66 | } |
||
67 | |||
68 | 1 | public function clear(): void |
|
71 | 1 | } |
|
72 | } |
||
73 |