Code Duplication    Length = 32-34 lines in 2 locations

src/PhpSpreadsheet/Reader/Xls.php 2 locations

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