Code Duplication    Length = 11-17 lines in 4 locations

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

@@ 1782-1793 (lines=12) @@
1779
    /**
1780
     * Store the horizontal centering HCENTER BIFF record.
1781
     */
1782
    private function writeHcenter()
1783
    {
1784
        $record = 0x0083; // Record identifier
1785
        $length = 0x0002; // Bytes to follow
1786
1787
        $fHCenter = $this->phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering
1788
1789
        $header = pack('vv', $record, $length);
1790
        $data = pack('v', $fHCenter);
1791
1792
        $this->append($header . $data);
1793
    }
1794
1795
    /**
1796
     * Store the vertical centering VCENTER BIFF record.
@@ 1798-1808 (lines=11) @@
1795
    /**
1796
     * Store the vertical centering VCENTER BIFF record.
1797
     */
1798
    private function writeVcenter()
1799
    {
1800
        $record = 0x0084; // Record identifier
1801
        $length = 0x0002; // Bytes to follow
1802
1803
        $fVCenter = $this->phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering
1804
1805
        $header = pack('vv', $record, $length);
1806
        $data = pack('v', $fVCenter);
1807
        $this->append($header . $data);
1808
    }
1809
1810
    /**
1811
     * Store the LEFTMARGIN BIFF record.
@@ 1905-1915 (lines=11) @@
1902
     * Write the PRINTGRIDLINES BIFF record. Must be used in conjunction with the
1903
     * GRIDSET record.
1904
     */
1905
    private function writePrintGridlines()
1906
    {
1907
        $record = 0x002b; // Record identifier
1908
        $length = 0x0002; // Bytes to follow
1909
1910
        $fPrintGrid = $this->phpSheet->getPrintGridlines() ? 1 : 0; // Boolean flag
1911
1912
        $header = pack('vv', $record, $length);
1913
        $data = pack('v', $fPrintGrid);
1914
        $this->append($header . $data);
1915
    }
1916
1917
    /**
1918
     * Write the GRIDSET BIFF record. Must be used in conjunction with the
@@ 2118-2134 (lines=17) @@
2115
    /**
2116
     * Set the Biff PROTECT record to indicate that the worksheet is protected.
2117
     */
2118
    private function writeProtect()
2119
    {
2120
        // Exit unless sheet protection has been specified
2121
        if (!$this->phpSheet->getProtection()->getSheet()) {
2122
            return;
2123
        }
2124
2125
        $record = 0x0012; // Record identifier
2126
        $length = 0x0002; // Bytes to follow
2127
2128
        $fLock = 1; // Worksheet is protected
2129
2130
        $header = pack('vv', $record, $length);
2131
        $data = pack('v', $fLock);
2132
2133
        $this->append($header . $data);
2134
    }
2135
2136
    /**
2137
     * Write SCENPROTECT.