Code Duplication    Length = 10-20 lines in 3 locations

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

@@ 939-948 (lines=10) @@
936
     *
937
     * @param string $stringValue
938
     */
939
    private function writeStringRecord($stringValue)
940
    {
941
        $record = 0x0207; // Record identifier
942
        $data = \PhpOffice\PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeLong($stringValue);
943
944
        $length = strlen($data);
945
        $header = pack('vv', $record, $length);
946
947
        $this->append($header . $data);
948
    }
949
950
    /**
951
     * Write a hyperlink.
@@ 1855-1874 (lines=20) @@
1852
    /**
1853
     * Store the header caption BIFF record.
1854
     */
1855
    private function writeHeader()
1856
    {
1857
        $record = 0x0014; // Record identifier
1858
1859
        /* removing for now
1860
        // need to fix character count (multibyte!)
1861
        if (strlen($this->phpSheet->getHeaderFooter()->getOddHeader()) <= 255) {
1862
            $str      = $this->phpSheet->getHeaderFooter()->getOddHeader();       // header string
1863
        } else {
1864
            $str = '';
1865
        }
1866
        */
1867
1868
        $recordData = \PhpOffice\PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddHeader());
1869
        $length = strlen($recordData);
1870
1871
        $header = pack('vv', $record, $length);
1872
1873
        $this->append($header . $recordData);
1874
    }
1875
1876
    /**
1877
     * Store the footer caption BIFF record.
@@ 1879-1898 (lines=20) @@
1876
    /**
1877
     * Store the footer caption BIFF record.
1878
     */
1879
    private function writeFooter()
1880
    {
1881
        $record = 0x0015; // Record identifier
1882
1883
        /* removing for now
1884
        // need to fix character count (multibyte!)
1885
        if (strlen($this->phpSheet->getHeaderFooter()->getOddFooter()) <= 255) {
1886
            $str = $this->phpSheet->getHeaderFooter()->getOddFooter();
1887
        } else {
1888
            $str = '';
1889
        }
1890
        */
1891
1892
        $recordData = \PhpOffice\PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddFooter());
1893
        $length = strlen($recordData);
1894
1895
        $header = pack('vv', $record, $length);
1896
1897
        $this->append($header . $recordData);
1898
    }
1899
1900
    /**
1901
     * Store the horizontal centering HCENTER BIFF record.