Code Duplication    Length = 32-34 lines in 2 locations

src/PhpSpreadsheet/Reader/Xls.php 2 locations

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