file = new SplFileInfo($this->filePath); if (!$this->file->isReadable() || $this->file->getExtension() !== 'csv') { throw new ConnectionException("File is not readable or is not a CSV file"); } $this->isConnected = true; return true; } catch (\Exception $e) { $this->isConnected = false; throw new ConnectionException("Failed to connect to CSV source: {$e->getMessage()}"); } } public function disconnect(): void { $this->file = null; $this->isConnected = false; } public function isConnected(): bool { return $this->isConnected; } public function getSourceType(): string { return 'csv'; } public function getSourceIdentifier(): string { return $this->identifier; } public function getFile(): ?SplFileInfo { return $this->file; } }