_total_rows = count($result); $this->_current_row = key($result); } public function __destruct() { // Cached results do not use resources } public function cached() { return $this; } public function current() { // Return an array of the row return $this->valid() ? $this->_result[$this->_current_row] : NULL; } public function key() { return $this->_current_row; } public function next() { next($this->_result); $this->_current_row = key($this->_result); return $this; } public function offsetExists($offset) { return isset($this->_result[$offset]); } public function rewind() { // We dont index by numbers, so we can just return reset($this->_result); $this->_current_row = key($this->_result); return $this; } public function seek($offset) { if (isset($this->_result[$offset])) { $this->_current_row = $offset; return TRUE; } else { return FALSE; } } } // End Database_LDAP_Result_Cached