Code Duplication    Length = 6-6 lines in 2 locations

src/PhpSpreadsheet/Writer/Excel2007.php 1 location

@@ 388-393 (lines=6) @@
385
            }
386
387
            // If a temporary file was used, copy it to the correct file stream
388
            if ($originalFilename != $pFilename) {
389
                if (copy($pFilename, $originalFilename) === false) {
390
                    throw new \PhpOffice\PhpSpreadsheet\Writer\Exception("Could not copy temporary zip file $pFilename to $originalFilename.");
391
                }
392
                @unlink($pFilename);
393
            }
394
        } else {
395
            throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('PhpSpreadsheet object unassigned.');
396
        }

src/PhpSpreadsheet/Writer/OpenDocument.php 1 location

@@ 124-129 (lines=6) @@
121
        }
122
123
        // If a temporary file was used, copy it to the correct file stream
124
        if ($originalFilename != $pFilename) {
125
            if (copy($pFilename, $originalFilename) === false) {
126
                throw new \PhpOffice\PhpSpreadsheet\Writer\Exception("Could not copy temporary zip file $pFilename to $originalFilename.");
127
            }
128
            @unlink($pFilename);
129
        }
130
    }
131
132
    /**