1: <?php
2:
3: namespace PHPixie\ORM\Data\Types\Document\Node\ArrayNode;
4:
5: class Iterator implements \Iterator
6: {
7: protected $documentArray;
8: protected $key = 0;
9:
10: public function __construct($documentArray)
11: {
12: $this->documentArray = $documentArray;
13: }
14:
15: public function current()
16: {
17: return $this->documentArray->offsetGet($this->key);
18: }
19:
20: public function next()
21: {
22: if($this->valid())
23: $this->key++;
24: }
25:
26: public function key()
27: {
28: return $this->key;
29: }
30:
31: public function rewind()
32: {
33: $this->key = 0;
34: }
35:
36: public function valid()
37: {
38: return $this->key < $this->documentArray->count();
39: }
40:
41: }