saveToTempFile($content); } private function saveToTempFile(string $content): void { $this->tempFileName = sprintf('%s/%s_%s', sys_get_temp_dir(), 'Document', time()); file_put_contents($this->tempFileName, $content); } public function remove(): bool { if (file_exists($this->tempFileName)) { unlink($this->tempFileName); return true; } throw new RuntimeException('Temp file not found'); } }