Code Duplication    Length = 6-6 lines in 2 locations

src/PhpSpreadsheet/Writer/Excel2007.php 1 location

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

src/PhpSpreadsheet/Writer/OpenDocument.php 1 location

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