Code Duplication    Length = 14-20 lines in 3 locations

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

@@ 2134-2153 (lines=20) @@
2131
    /**
2132
     * Write SCENPROTECT.
2133
     */
2134
    private function writeScenProtect()
2135
    {
2136
        // Exit if sheet protection is not active
2137
        if (!$this->phpSheet->getProtection()->getSheet()) {
2138
            return;
2139
        }
2140
2141
        // Exit if scenarios are not protected
2142
        if (!$this->phpSheet->getProtection()->getScenarios()) {
2143
            return;
2144
        }
2145
2146
        $record = 0x00DD; // Record identifier
2147
        $length = 0x0002; // Bytes to follow
2148
2149
        $header = pack('vv', $record, $length);
2150
        $data = pack('v', 1);
2151
2152
        $this->append($header . $data);
2153
    }
2154
2155
    /**
2156
     * Write OBJECTPROTECT.
@@ 2158-2177 (lines=20) @@
2155
    /**
2156
     * Write OBJECTPROTECT.
2157
     */
2158
    private function writeObjectProtect()
2159
    {
2160
        // Exit if sheet protection is not active
2161
        if (!$this->phpSheet->getProtection()->getSheet()) {
2162
            return;
2163
        }
2164
2165
        // Exit if objects are not protected
2166
        if (!$this->phpSheet->getProtection()->getObjects()) {
2167
            return;
2168
        }
2169
2170
        $record = 0x0063; // Record identifier
2171
        $length = 0x0002; // Bytes to follow
2172
2173
        $header = pack('vv', $record, $length);
2174
        $data = pack('v', 1);
2175
2176
        $this->append($header . $data);
2177
    }
2178
2179
    /**
2180
     * Write the worksheet PASSWORD record.
@@ 2535-2548 (lines=14) @@
2532
     * Store the window zoom factor. This should be a reduced fraction but for
2533
     * simplicity we will store all fractions with a numerator of 100.
2534
     */
2535
    private function writeZoom()
2536
    {
2537
        // If scale is 100 we don't need to write a record
2538
        if ($this->phpSheet->getSheetView()->getZoomScale() == 100) {
2539
            return;
2540
        }
2541
2542
        $record = 0x00A0; // Record identifier
2543
        $length = 0x0004; // Bytes to follow
2544
2545
        $header = pack('vv', $record, $length);
2546
        $data = pack('vv', $this->phpSheet->getSheetView()->getZoomScale(), 100);
2547
        $this->append($header . $data);
2548
    }
2549
2550
    /**
2551
     * Get Escher object.