Code Duplication    Length = 10-20 lines in 3 locations

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

@@ 915-924 (lines=10) @@
912
     *
913
     * @param string $stringValue
914
     */
915
    private function writeStringRecord($stringValue)
916
    {
917
        $record = 0x0207;     // Record identifier
918
        $data = \PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeLong($stringValue);
919
920
        $length = strlen($data);
921
        $header = pack('vv', $record, $length);
922
923
        $this->append($header . $data);
924
    }
925
926
    /**
927
     * Write a hyperlink.
@@ 1829-1848 (lines=20) @@
1826
    /**
1827
     * Store the header caption BIFF record.
1828
     */
1829
    private function writeHeader()
1830
    {
1831
        $record  = 0x0014;               // Record identifier
1832
1833
        /* removing for now
1834
        // need to fix character count (multibyte!)
1835
        if (strlen($this->phpSheet->getHeaderFooter()->getOddHeader()) <= 255) {
1836
            $str      = $this->phpSheet->getHeaderFooter()->getOddHeader();       // header string
1837
        } else {
1838
            $str = '';
1839
        }
1840
        */
1841
1842
        $recordData = \PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddHeader());
1843
        $length = strlen($recordData);
1844
1845
        $header   = pack("vv", $record, $length);
1846
1847
        $this->append($header . $recordData);
1848
    }
1849
1850
    /**
1851
     * Store the footer caption BIFF record.
@@ 1853-1872 (lines=20) @@
1850
    /**
1851
     * Store the footer caption BIFF record.
1852
     */
1853
    private function writeFooter()
1854
    {
1855
        $record  = 0x0015;               // Record identifier
1856
1857
        /* removing for now
1858
        // need to fix character count (multibyte!)
1859
        if (strlen($this->phpSheet->getHeaderFooter()->getOddFooter()) <= 255) {
1860
            $str = $this->phpSheet->getHeaderFooter()->getOddFooter();
1861
        } else {
1862
            $str = '';
1863
        }
1864
        */
1865
1866
        $recordData = \PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddFooter());
1867
        $length = strlen($recordData);
1868
1869
        $header    = pack("vv", $record, $length);
1870
1871
        $this->append($header . $recordData);
1872
    }
1873
1874
    /**
1875
     * Store the horizontal centering HCENTER BIFF record.