public function next()
{
if ($this->_buffer) {
list($this->_key, $this->_current) = array_shift($this->_buffer);
return $this->_current;
}
if (!($next = $this->_fetch())) {
$this->_key = null;
$this->_current = null;
$this->_valid = false;
return null;
} else {
list($this->_key, $this->_current) = $next;
$this->_valid = true;
}
return $this->_current;
}