Code Duplication    Length = 11-17 lines in 4 locations

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

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