Code Duplication    Length = 6-6 lines in 2 locations

src/PhpSpreadsheet/Writer/Ods.php 1 location

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

src/PhpSpreadsheet/Writer/Xlsx.php 1 location

@@ 381-386 (lines=6) @@
378
            }
379
380
            // If a temporary file was used, copy it to the correct file stream
381
            if ($originalFilename != $pFilename) {
382
                if (copy($pFilename, $originalFilename) === false) {
383
                    throw new \PhpOffice\PhpSpreadsheet\Writer\Exception("Could not copy temporary zip file $pFilename to $originalFilename.");
384
                }
385
                @unlink($pFilename);
386
            }
387
        } else {
388
            throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('PhpSpreadsheet object unassigned.');
389
        }