Code Duplication    Length = 14-20 lines in 3 locations

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

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