Code Duplication    Length = 16-17 lines in 2 locations

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

@@ 671-686 (lines=16) @@
668
     * @param int   $xfIndex The XF format index for the cell
669
     * @param array $arrcRun Index to Font record and characters beginning
670
     */
671
    private function writeRichTextString($row, $col, $str, $xfIndex, $arrcRun)
672
    {
673
        $record = 0x00FD; // Record identifier
674
        $length = 0x000A; // Bytes to follow
675
        $str = \PhpOffice\PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeShort($str, $arrcRun);
676
677
        /* check if string is already present */
678
        if (!isset($this->stringTable[$str])) {
679
            $this->stringTable[$str] = $this->stringUnique++;
680
        }
681
        ++$this->stringTotal;
682
683
        $header = pack('vv', $record, $length);
684
        $data = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]);
685
        $this->append($header . $data);
686
    }
687
688
    /**
689
     * Write a string to the specified row and column (zero indexed).
@@ 740-756 (lines=17) @@
737
     *
738
     * @return int
739
     */
740
    private function writeLabelSst($row, $col, $str, $xfIndex)
741
    {
742
        $record = 0x00FD; // Record identifier
743
        $length = 0x000A; // Bytes to follow
744
745
        $str = \PhpOffice\PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeLong($str);
746
747
        /* check if string is already present */
748
        if (!isset($this->stringTable[$str])) {
749
            $this->stringTable[$str] = $this->stringUnique++;
750
        }
751
        ++$this->stringTotal;
752
753
        $header = pack('vv', $record, $length);
754
        $data = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]);
755
        $this->append($header . $data);
756
    }
757
758
    /**
759
     * Writes a note associated with the cell given by the row and column.