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 \PhpOffice\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

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