public function previousRecord()
{
if (!$this->isOpen()) {
$this->open();
}
if ($this->record) {
$this->record->destroy();
$this->record = null;
}
$valid = false;
do {
if ($this->recordPos - 1 < 0) {
return false;
}
$this->recordPos--;
fseek($this->fp, $this->headerLength + $this->recordPos * $this->recordByteLength);
$this->record = new Record($this, $this->recordPos, $this->readBytes($this->recordByteLength));
if ($this->record->isDeleted()) {
$this->deleteCount++;
} else {
$valid = true;
}
} while (!$valid);
return $this->record;
}