Code Duplication    Length = 16-17 lines in 2 locations

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

@@ 646-661 (lines=16) @@
643
     * @param int   $xfIndex The XF format index for the cell
644
     * @param array $arrcRun Index to Font record and characters beginning
645
     */
646
    private function writeRichTextString($row, $col, $str, $xfIndex, $arrcRun)
647
    {
648
        $record = 0x00FD; // Record identifier
649
        $length = 0x000A; // Bytes to follow
650
        $str = \PhpOffice\PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeShort($str, $arrcRun);
651
652
        /* check if string is already present */
653
        if (!isset($this->stringTable[$str])) {
654
            $this->stringTable[$str] = $this->stringUnique++;
655
        }
656
        ++$this->stringTotal;
657
658
        $header = pack('vv', $record, $length);
659
        $data = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]);
660
        $this->append($header . $data);
661
    }
662
663
    /**
664
     * Write a string to the specified row and column (zero indexed).
@@ 713-729 (lines=17) @@
710
     * @param mixed   $xfIndex The XF format index for the cell
711
     * @return int
712
     */
713
    private function writeLabelSst($row, $col, $str, $xfIndex)
714
    {
715
        $record = 0x00FD; // Record identifier
716
        $length = 0x000A; // Bytes to follow
717
718
        $str = \PhpOffice\PhpSpreadsheet\Shared\StringHelper::UTF8toBIFF8UnicodeLong($str);
719
720
        /* check if string is already present */
721
        if (!isset($this->stringTable[$str])) {
722
            $this->stringTable[$str] = $this->stringUnique++;
723
        }
724
        ++$this->stringTotal;
725
726
        $header = pack('vv', $record, $length);
727
        $data = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]);
728
        $this->append($header . $data);
729
    }
730
731
    /**
732
     * Writes a note associated with the cell given by the row and column.