Code Duplication    Length = 11-17 lines in 4 locations

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

@@ 1903-1914 (lines=12) @@
1900
    /**
1901
     * Store the horizontal centering HCENTER BIFF record.
1902
     */
1903
    private function writeHcenter()
1904
    {
1905
        $record = 0x0083; // Record identifier
1906
        $length = 0x0002; // Bytes to follow
1907
1908
        $fHCenter = $this->phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering
1909
1910
        $header = pack('vv', $record, $length);
1911
        $data = pack('v', $fHCenter);
1912
1913
        $this->append($header . $data);
1914
    }
1915
1916
    /**
1917
     * Store the vertical centering VCENTER BIFF record.
@@ 1919-1929 (lines=11) @@
1916
    /**
1917
     * Store the vertical centering VCENTER BIFF record.
1918
     */
1919
    private function writeVcenter()
1920
    {
1921
        $record = 0x0084; // Record identifier
1922
        $length = 0x0002; // Bytes to follow
1923
1924
        $fVCenter = $this->phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering
1925
1926
        $header = pack('vv', $record, $length);
1927
        $data = pack('v', $fVCenter);
1928
        $this->append($header . $data);
1929
    }
1930
1931
    /**
1932
     * Store the LEFTMARGIN BIFF record.
@@ 2026-2036 (lines=11) @@
2023
     * Write the PRINTGRIDLINES BIFF record. Must be used in conjunction with the
2024
     * GRIDSET record.
2025
     */
2026
    private function writePrintGridlines()
2027
    {
2028
        $record = 0x002b; // Record identifier
2029
        $length = 0x0002; // Bytes to follow
2030
2031
        $fPrintGrid = $this->phpSheet->getPrintGridlines() ? 1 : 0; // Boolean flag
2032
2033
        $header = pack('vv', $record, $length);
2034
        $data = pack('v', $fPrintGrid);
2035
        $this->append($header . $data);
2036
    }
2037
2038
    /**
2039
     * Write the GRIDSET BIFF record. Must be used in conjunction with the
@@ 2237-2253 (lines=17) @@
2234
    /**
2235
     * Set the Biff PROTECT record to indicate that the worksheet is protected.
2236
     */
2237
    private function writeProtect()
2238
    {
2239
        // Exit unless sheet protection has been specified
2240
        if (!$this->phpSheet->getProtection()->getSheet()) {
2241
            return;
2242
        }
2243
2244
        $record = 0x0012; // Record identifier
2245
        $length = 0x0002; // Bytes to follow
2246
2247
        $fLock = 1; // Worksheet is protected
2248
2249
        $header = pack('vv', $record, $length);
2250
        $data = pack('v', $fLock);
2251
2252
        $this->append($header . $data);
2253
    }
2254
2255
    /**
2256
     * Write SCENPROTECT.