Code Duplication    Length = 11-17 lines in 4 locations

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

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