Code Duplication    Length = 14-20 lines in 3 locations

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

@@ 2234-2253 (lines=20) @@
2231
    /**
2232
     * Write SCENPROTECT
2233
     */
2234
    private function writeScenProtect()
2235
    {
2236
        // Exit if sheet protection is not active
2237
        if (!$this->phpSheet->getProtection()->getSheet()) {
2238
            return;
2239
        }
2240
2241
        // Exit if scenarios are not protected
2242
        if (!$this->phpSheet->getProtection()->getScenarios()) {
2243
            return;
2244
        }
2245
2246
        $record = 0x00DD; // Record identifier
2247
        $length = 0x0002; // Bytes to follow
2248
2249
        $header = pack('vv', $record, $length);
2250
        $data = pack('v', 1);
2251
2252
        $this->append($header . $data);
2253
    }
2254
2255
    /**
2256
     * Write OBJECTPROTECT
@@ 2258-2277 (lines=20) @@
2255
    /**
2256
     * Write OBJECTPROTECT
2257
     */
2258
    private function writeObjectProtect()
2259
    {
2260
        // Exit if sheet protection is not active
2261
        if (!$this->phpSheet->getProtection()->getSheet()) {
2262
            return;
2263
        }
2264
2265
        // Exit if objects are not protected
2266
        if (!$this->phpSheet->getProtection()->getObjects()) {
2267
            return;
2268
        }
2269
2270
        $record = 0x0063; // 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 the worksheet PASSWORD record.
@@ 2639-2652 (lines=14) @@
2636
     * Store the window zoom factor. This should be a reduced fraction but for
2637
     * simplicity we will store all fractions with a numerator of 100.
2638
     */
2639
    private function writeZoom()
2640
    {
2641
        // If scale is 100 we don't need to write a record
2642
        if ($this->phpSheet->getSheetView()->getZoomScale() == 100) {
2643
            return;
2644
        }
2645
2646
        $record      = 0x00A0;               // Record identifier
2647
        $length      = 0x0004;               // Bytes to follow
2648
2649
        $header      = pack("vv", $record, $length);
2650
        $data        = pack("vv", $this->phpSheet->getSheetView()->getZoomScale(), 100);
2651
        $this->append($header . $data);
2652
    }
2653
2654
    /**
2655
     * Get Escher object