/framework/core/xml/XmlNodeList.php
PHP | 38 lines | 34 code | 4 blank | 0 comment | 1 complexity | b234438585a81ed6d86cb5f52b9f77b8 MD5 | raw file
1<?php 2class XmlNodeList implements Iterator 3{ 4 var $nodeList; 5 6 function XmlNodeList($inNodeData) 7 { 8 $this->nodeList = $inNodeData->firstChild; 9 } 10 11 function rewind() 12 { 13 if($this->valid()) 14 $this->nodeList = $this->nodeList->parentNode->firstChild; 15 } 16 17 function current() 18 { 19 return is_null($this->nodeList) ? false : new XmlNode($this->nodeList); 20 } 21 22 function key() 23 { 24 trigger_error("I don't think that we actually use this"); 25 return key($this->nodeList); 26 } 27 28 function next() 29 { 30 $this->nodeList = $this->nodeList->nextSibling; 31 return is_null($this->nodeList) ? false : new XmlNode($this->nodeList); 32 } 33 34 function valid() 35 { 36 return $this->current() !== false; 37 } 38}