Code Duplication    Length = 11-17 lines in 4 locations

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

@@ 1915-1926 (lines=12) @@
1912
    /**
1913
     * Store the horizontal centering HCENTER BIFF record.
1914
     */
1915
    private function writeHcenter()
1916
    {
1917
        $record = 0x0083; // Record identifier
1918
        $length = 0x0002; // Bytes to follow
1919
1920
        $fHCenter = $this->phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering
1921
1922
        $header = pack('vv', $record, $length);
1923
        $data = pack('v', $fHCenter);
1924
1925
        $this->append($header . $data);
1926
    }
1927
1928
    /**
1929
     * Store the vertical centering VCENTER BIFF record.
@@ 1931-1941 (lines=11) @@
1928
    /**
1929
     * Store the vertical centering VCENTER BIFF record.
1930
     */
1931
    private function writeVcenter()
1932
    {
1933
        $record = 0x0084; // Record identifier
1934
        $length = 0x0002; // Bytes to follow
1935
1936
        $fVCenter = $this->phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering
1937
1938
        $header = pack('vv', $record, $length);
1939
        $data = pack('v', $fVCenter);
1940
        $this->append($header . $data);
1941
    }
1942
1943
    /**
1944
     * Store the LEFTMARGIN BIFF record.
@@ 2038-2048 (lines=11) @@
2035
     * Write the PRINTGRIDLINES BIFF record. Must be used in conjunction with the
2036
     * GRIDSET record.
2037
     */
2038
    private function writePrintGridlines()
2039
    {
2040
        $record = 0x002b; // Record identifier
2041
        $length = 0x0002; // Bytes to follow
2042
2043
        $fPrintGrid = $this->phpSheet->getPrintGridlines() ? 1 : 0; // Boolean flag
2044
2045
        $header = pack('vv', $record, $length);
2046
        $data = pack('v', $fPrintGrid);
2047
        $this->append($header . $data);
2048
    }
2049
2050
    /**
2051
     * Write the GRIDSET BIFF record. Must be used in conjunction with the
@@ 2249-2265 (lines=17) @@
2246
    /**
2247
     * Set the Biff PROTECT record to indicate that the worksheet is protected.
2248
     */
2249
    private function writeProtect()
2250
    {
2251
        // Exit unless sheet protection has been specified
2252
        if (!$this->phpSheet->getProtection()->getSheet()) {
2253
            return;
2254
        }
2255
2256
        $record = 0x0012; // Record identifier
2257
        $length = 0x0002; // Bytes to follow
2258
2259
        $fLock = 1; // Worksheet is protected
2260
2261
        $header = pack('vv', $record, $length);
2262
        $data = pack('v', $fLock);
2263
2264
        $this->append($header . $data);
2265
    }
2266
2267
    /**
2268
     * Write SCENPROTECT.