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