Code Duplication    Length = 6-6 lines in 2 locations

src/PhpSpreadsheet/Writer/Ods.php 1 location

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

src/PhpSpreadsheet/Writer/Xlsx.php 1 location

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