| @@ 39-52 (lines=14) @@ | ||
| 36 | $this->generator = $generator; |
|
| 37 | } |
|
| 38 | ||
| 39 | public function rewind() |
|
| 40 | { |
|
| 41 | if (isset($this->generator)) { |
|
| 42 | // If generator has already been used, given generators can't start over we will need to load all |
|
| 43 | if ($this->generatorUsed) { |
|
| 44 | $this->loadAll(); |
|
| 45 | } else { |
|
| 46 | $this->generatorUsed = true; |
|
| 47 | $this->generator->rewind(); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| 51 | reset($this->array); |
|
| 52 | } |
|
| 53 | ||
| 54 | public function current() |
|
| 55 | { |
|
| @@ 73-81 (lines=9) @@ | ||
| 70 | return key($this->array); |
|
| 71 | } |
|
| 72 | ||
| 73 | public function next() |
|
| 74 | { |
|
| 75 | if (isset($this->generator)) { |
|
| 76 | $this->generatorUsed = true; |
|
| 77 | $this->generator->next(); |
|
| 78 | } |
|
| 79 | ||
| 80 | next($this->array); |
|
| 81 | } |
|
| 82 | ||
| 83 | public function valid() |
|
| 84 | { |
|