Code Duplication    Length = 14-20 lines in 3 locations

src/PhpSpreadsheet/Writer/Xls/Worksheet.php 3 locations

@@ 2270-2289 (lines=20) @@
2267
    /**
2268
     * Write SCENPROTECT.
2269
     */
2270
    private function writeScenProtect()
2271
    {
2272
        // Exit if sheet protection is not active
2273
        if (!$this->phpSheet->getProtection()->getSheet()) {
2274
            return;
2275
        }
2276
2277
        // Exit if scenarios are not protected
2278
        if (!$this->phpSheet->getProtection()->getScenarios()) {
2279
            return;
2280
        }
2281
2282
        $record = 0x00DD; // Record identifier
2283
        $length = 0x0002; // Bytes to follow
2284
2285
        $header = pack('vv', $record, $length);
2286
        $data = pack('v', 1);
2287
2288
        $this->append($header . $data);
2289
    }
2290
2291
    /**
2292
     * Write OBJECTPROTECT.
@@ 2294-2313 (lines=20) @@
2291
    /**
2292
     * Write OBJECTPROTECT.
2293
     */
2294
    private function writeObjectProtect()
2295
    {
2296
        // Exit if sheet protection is not active
2297
        if (!$this->phpSheet->getProtection()->getSheet()) {
2298
            return;
2299
        }
2300
2301
        // Exit if objects are not protected
2302
        if (!$this->phpSheet->getProtection()->getObjects()) {
2303
            return;
2304
        }
2305
2306
        $record = 0x0063; // Record identifier
2307
        $length = 0x0002; // Bytes to follow
2308
2309
        $header = pack('vv', $record, $length);
2310
        $data = pack('v', 1);
2311
2312
        $this->append($header . $data);
2313
    }
2314
2315
    /**
2316
     * Write the worksheet PASSWORD record.
@@ 2671-2684 (lines=14) @@
2668
     * Store the window zoom factor. This should be a reduced fraction but for
2669
     * simplicity we will store all fractions with a numerator of 100.
2670
     */
2671
    private function writeZoom()
2672
    {
2673
        // If scale is 100 we don't need to write a record
2674
        if ($this->phpSheet->getSheetView()->getZoomScale() == 100) {
2675
            return;
2676
        }
2677
2678
        $record = 0x00A0; // Record identifier
2679
        $length = 0x0004; // Bytes to follow
2680
2681
        $header = pack('vv', $record, $length);
2682
        $data = pack('vv', $this->phpSheet->getSheetView()->getZoomScale(), 100);
2683
        $this->append($header . $data);
2684
    }
2685
2686
    /**
2687
     * Get Escher object.