diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Service/Ebay/Finding/Set/Abstract.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Service/Ebay/Finding/Set/Abstract.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,128 @@ +_nodes = $nodes; + $this->_init(); + } + + /** + * Initialize object. + * + * Called from {@link __construct()} as final step of object initialization. + * + * @return void + */ + protected function _init() + { + } + + /** + * Implement SeekableIterator::seek() + * + * @param integer $key + * @throws OutOfBoundsException When $key is not seekable + * @return void + */ + public function seek($key) + { + if ($key < 0 || $key >= $this->count()) { + $message = "Position '{$key}' is not seekable."; + throw new OutOfBoundsException($message); + } + $this->_key = $key; + } + + /** + * Implement Iterator::key() + * + * @return integer + */ + public function key() + { + return $this->_key; + } + + /** + * Implement Iterator::next() + * + * @return void + */ + public function next() + { + $this->_key++; + } + + /** + * Implement Iterator::rewind() + * + * @return void + */ + public function rewind() + { + $this->_key = 0; + } + + /** + * Implement Iterator::valid() + * + * @return boolean + */ + public function valid() + { + return $this->_key >= 0 && $this->_key < $this->count(); + } + + /** + * Implement Countable::current() + * + * @return integer + */ + public function count() + { + return $this->_nodes ? $this->_nodes->length : 0; + } +}