Code Duplication    Length = 6-6 lines in 2 locations

src/PhpSpreadsheet/Writer/Ods.php 1 location

@@ 114-119 (lines=6) @@
111
        }
112
113
        // If a temporary file was used, copy it to the correct file stream
114
        if ($originalFilename != $pFilename) {
115
            if (copy($pFilename, $originalFilename) === false) {
116
                throw new WriterException("Could not copy temporary zip file $pFilename to $originalFilename.");
117
            }
118
            @unlink($pFilename);
119
        }
120
    }
121
122
    /**

src/PhpSpreadsheet/Writer/Xlsx.php 1 location

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