public function valid() { if (!is_array($this->currentLine)) { if (is_resource($this->file)) { fclose($this->file); } return false; } return true; }