Code Duplication    Length = 14-20 lines in 3 locations

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

@@ 2219-2238 (lines=20) @@
2216
    /**
2217
     * Write SCENPROTECT
2218
     */
2219
    private function writeScenProtect()
2220
    {
2221
        // Exit if sheet protection is not active
2222
        if (!$this->phpSheet->getProtection()->getSheet()) {
2223
            return;
2224
        }
2225
2226
        // Exit if scenarios are not protected
2227
        if (!$this->phpSheet->getProtection()->getScenarios()) {
2228
            return;
2229
        }
2230
2231
        $record = 0x00DD; // Record identifier
2232
        $length = 0x0002; // Bytes to follow
2233
2234
        $header = pack('vv', $record, $length);
2235
        $data = pack('v', 1);
2236
2237
        $this->append($header . $data);
2238
    }
2239
2240
    /**
2241
     * Write OBJECTPROTECT
@@ 2243-2262 (lines=20) @@
2240
    /**
2241
     * Write OBJECTPROTECT
2242
     */
2243
    private function writeObjectProtect()
2244
    {
2245
        // Exit if sheet protection is not active
2246
        if (!$this->phpSheet->getProtection()->getSheet()) {
2247
            return;
2248
        }
2249
2250
        // Exit if objects are not protected
2251
        if (!$this->phpSheet->getProtection()->getObjects()) {
2252
            return;
2253
        }
2254
2255
        $record = 0x0063; // Record identifier
2256
        $length = 0x0002; // Bytes to follow
2257
2258
        $header = pack('vv', $record, $length);
2259
        $data = pack('v', 1);
2260
2261
        $this->append($header . $data);
2262
    }
2263
2264
    /**
2265
     * Write the worksheet PASSWORD record.
@@ 2618-2631 (lines=14) @@
2615
     * Store the window zoom factor. This should be a reduced fraction but for
2616
     * simplicity we will store all fractions with a numerator of 100.
2617
     */
2618
    private function writeZoom()
2619
    {
2620
        // If scale is 100 we don't need to write a record
2621
        if ($this->phpSheet->getSheetView()->getZoomScale() == 100) {
2622
            return;
2623
        }
2624
2625
        $record = 0x00A0; // Record identifier
2626
        $length = 0x0004; // Bytes to follow
2627
2628
        $header = pack('vv', $record, $length);
2629
        $data = pack('vv', $this->phpSheet->getSheetView()->getZoomScale(), 100);
2630
        $this->append($header . $data);
2631
    }
2632
2633
    /**
2634
     * Get Escher object