Code Duplication    Length = 14-20 lines in 3 locations

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

@@ 2256-2275 (lines=20) @@
2253
    /**
2254
     * Write SCENPROTECT.
2255
     */
2256
    private function writeScenProtect()
2257
    {
2258
        // Exit if sheet protection is not active
2259
        if (!$this->phpSheet->getProtection()->getSheet()) {
2260
            return;
2261
        }
2262
2263
        // Exit if scenarios are not protected
2264
        if (!$this->phpSheet->getProtection()->getScenarios()) {
2265
            return;
2266
        }
2267
2268
        $record = 0x00DD; // Record identifier
2269
        $length = 0x0002; // Bytes to follow
2270
2271
        $header = pack('vv', $record, $length);
2272
        $data = pack('v', 1);
2273
2274
        $this->append($header . $data);
2275
    }
2276
2277
    /**
2278
     * Write OBJECTPROTECT.
@@ 2280-2299 (lines=20) @@
2277
    /**
2278
     * Write OBJECTPROTECT.
2279
     */
2280
    private function writeObjectProtect()
2281
    {
2282
        // Exit if sheet protection is not active
2283
        if (!$this->phpSheet->getProtection()->getSheet()) {
2284
            return;
2285
        }
2286
2287
        // Exit if objects are not protected
2288
        if (!$this->phpSheet->getProtection()->getObjects()) {
2289
            return;
2290
        }
2291
2292
        $record = 0x0063; // Record identifier
2293
        $length = 0x0002; // Bytes to follow
2294
2295
        $header = pack('vv', $record, $length);
2296
        $data = pack('v', 1);
2297
2298
        $this->append($header . $data);
2299
    }
2300
2301
    /**
2302
     * Write the worksheet PASSWORD record.
@@ 2657-2670 (lines=14) @@
2654
     * Store the window zoom factor. This should be a reduced fraction but for
2655
     * simplicity we will store all fractions with a numerator of 100.
2656
     */
2657
    private function writeZoom()
2658
    {
2659
        // If scale is 100 we don't need to write a record
2660
        if ($this->phpSheet->getSheetView()->getZoomScale() == 100) {
2661
            return;
2662
        }
2663
2664
        $record = 0x00A0; // Record identifier
2665
        $length = 0x0004; // Bytes to follow
2666
2667
        $header = pack('vv', $record, $length);
2668
        $data = pack('vv', $this->phpSheet->getSheetView()->getZoomScale(), 100);
2669
        $this->append($header . $data);
2670
    }
2671
2672
    /**
2673
     * Get Escher object.