Code Duplication    Length = 10-20 lines in 3 locations

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

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