Code Duplication    Length = 32-34 lines in 2 locations

src/PhpSpreadsheet/Reader/Xls.php 2 locations

@@ 3537-3570 (lines=34) @@
3534
     * --    "OpenOffice.org's Documentation of the Microsoft
3535
     *         Excel File Format"
3536
     */
3537
    private function readRk()
3538
    {
3539
        $length = self::getInt2d($this->data, $this->pos + 2);
3540
        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
3541
3542
        // move stream pointer to next record
3543
        $this->pos += 4 + $length;
3544
3545
        // offset: 0; size: 2; index to row
3546
        $row = self::getInt2d($recordData, 0);
3547
3548
        // offset: 2; size: 2; index to column
3549
        $column = self::getInt2d($recordData, 2);
3550
        $columnString = \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($column);
3551
3552
        // Read cell?
3553
        if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
3554
            // offset: 4; size: 2; index to XF record
3555
            $xfIndex = self::getInt2d($recordData, 4);
3556
3557
            // offset: 6; size: 4; RK value
3558
            $rknum = self::getInt4d($recordData, 6);
3559
            $numValue = self::getIEEE754($rknum);
3560
3561
            $cell = $this->phpSheet->getCell($columnString . ($row + 1));
3562
            if (!$this->readDataOnly) {
3563
                // add style information
3564
                $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
3565
            }
3566
3567
            // add cell
3568
            $cell->setValueExplicit($numValue, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);
3569
        }
3570
    }
3571
3572
    /**
3573
     * Read LABELSST record
@@ 3718-3749 (lines=32) @@
3715
     * --    "OpenOffice.org's Documentation of the Microsoft
3716
     *         Excel File Format"
3717
     */
3718
    private function readNumber()
3719
    {
3720
        $length = self::getInt2d($this->data, $this->pos + 2);
3721
        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
3722
3723
        // move stream pointer to next record
3724
        $this->pos += 4 + $length;
3725
3726
        // offset: 0; size: 2; index to row
3727
        $row = self::getInt2d($recordData, 0);
3728
3729
        // offset: 2; size 2; index to column
3730
        $column = self::getInt2d($recordData, 2);
3731
        $columnString = \PhpOffice\PhpSpreadsheet\Cell::stringFromColumnIndex($column);
3732
3733
        // Read cell?
3734
        if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
3735
            // offset 4; size: 2; index to XF record
3736
            $xfIndex = self::getInt2d($recordData, 4);
3737
3738
            $numValue = self::extractNumber(substr($recordData, 6, 8));
3739
3740
            $cell = $this->phpSheet->getCell($columnString . ($row + 1));
3741
            if (!$this->readDataOnly) {
3742
                // add cell style
3743
                $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
3744
            }
3745
3746
            // add cell value
3747
            $cell->setValueExplicit($numValue, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC);
3748
        }
3749
    }
3750
3751
    /**
3752
     * Read FORMULA record + perhaps a following STRING record if formula result is a string