Code Duplication    Length = 11-17 lines in 4 locations

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

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