Code Duplication    Length = 14-20 lines in 3 locations

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

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