Code Duplication    Length = 14-20 lines in 3 locations

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

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