Code Duplication    Length = 5-5 lines in 2 locations

src/PhpSpreadsheet/Writer/Excel2007.php 1 location

@@ 224-228 (lines=5) @@
221
                unlink($pFilename);
222
            }
223
            // Try opening the ZIP file
224
            if ($objZip->open($pFilename, $zipOverWrite) !== true) {
225
                if ($objZip->open($pFilename, $zipCreate) !== true) {
226
                    throw new \PhpSpreadsheet\Writer\Exception("Could not open " . $pFilename . " for writing.");
227
                }
228
            }
229
230
            // Add [Content_Types].xml to ZIP file
231
            $objZip->addFromString('[Content_Types].xml', $this->getWriterPart('ContentTypes')->writeContentTypes($this->spreadSheet, $this->includeCharts));

src/PhpSpreadsheet/Writer/OpenDocument.php 1 location

@@ 153-157 (lines=5) @@
150
            unlink($pFilename);
151
        }
152
        // Try opening the ZIP file
153
        if ($objZip->open($pFilename, $zipOverWrite) !== true) {
154
            if ($objZip->open($pFilename, $zipCreate) !== true) {
155
                throw new \PhpSpreadsheet\Writer\Exception("Could not open $pFilename for writing.");
156
            }
157
        }
158
159
        return $objZip;
160
    }