| 1 | <?php namespace BetterDOMDocument; |
||
| 5 | class DOMList implements \Countable, \Iterator { |
||
| 6 | |||
| 7 | private $array = array(); |
||
| 8 | private $position = 0; |
||
| 9 | |||
| 10 | private $length = 0; |
||
| 11 | private $dom; |
||
| 12 | |||
| 13 | 18 | public function __construct(\DOMNodeList $DOMNodeList, DOMDoc $dom) { |
|
| 22 | |||
| 23 | // Provides read-only access to $length and $dom |
||
| 24 | public function __get ($prop) { |
||
| 35 | |||
| 36 | 1 | public function rewind() { |
|
| 37 | 1 | $this->position = 0; |
|
| 38 | 1 | } |
|
| 39 | |||
| 40 | 1 | public function current() { |
|
| 41 | 1 | return $this->array[$this->position]; |
|
| 42 | } |
||
| 43 | |||
| 44 | public function key() { |
||
| 47 | |||
| 48 | 1 | public function next() { |
|
| 49 | 1 | ++$this->position; |
|
| 50 | 1 | } |
|
| 51 | |||
| 52 | 1 | public function valid() { |
|
| 53 | 1 | return isset($this->array[$this->position]); |
|
| 54 | } |
||
| 55 | |||
| 56 | 17 | public function item($index) { |
|
| 62 | |||
| 63 | 18 | public function count() { |
|
| 66 | } |