Code Duplication    Length = 32-34 lines in 2 locations

src/PhpSpreadsheet/Reader/Xls.php 2 locations

@@ 3576-3609 (lines=34) @@
3573
     * --    "OpenOffice.org's Documentation of the Microsoft
3574
     *         Excel File Format"
3575
     */
3576
    private function readRk()
3577
    {
3578
        $length = self::getInt2d($this->data, $this->pos + 2);
3579
        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
3580
3581
        // move stream pointer to next record
3582
        $this->pos += 4 + $length;
3583
3584
        // offset: 0; size: 2; index to row
3585
        $row = self::getInt2d($recordData, 0);
3586
3587
        // offset: 2; size: 2; index to column
3588
        $column = self::getInt2d($recordData, 2);
3589
        $columnString = Cell::stringFromColumnIndex($column);
3590
3591
        // Read cell?
3592
        if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
3593
            // offset: 4; size: 2; index to XF record
3594
            $xfIndex = self::getInt2d($recordData, 4);
3595
3596
            // offset: 6; size: 4; RK value
3597
            $rknum = self::getInt4d($recordData, 6);
3598
            $numValue = self::getIEEE754($rknum);
3599
3600
            $cell = $this->phpSheet->getCell($columnString . ($row + 1));
3601
            if (!$this->readDataOnly) {
3602
                // add style information
3603
                $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
3604
            }
3605
3606
            // add cell
3607
            $cell->setValueExplicit($numValue, Cell\DataType::TYPE_NUMERIC);
3608
        }
3609
    }
3610
3611
    /**
3612
     * Read LABELSST record
@@ 3757-3788 (lines=32) @@
3754
     * --    "OpenOffice.org's Documentation of the Microsoft
3755
     *         Excel File Format"
3756
     */
3757
    private function readNumber()
3758
    {
3759
        $length = self::getInt2d($this->data, $this->pos + 2);
3760
        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
3761
3762
        // move stream pointer to next record
3763
        $this->pos += 4 + $length;
3764
3765
        // offset: 0; size: 2; index to row
3766
        $row = self::getInt2d($recordData, 0);
3767
3768
        // offset: 2; size 2; index to column
3769
        $column = self::getInt2d($recordData, 2);
3770
        $columnString = Cell::stringFromColumnIndex($column);
3771
3772
        // Read cell?
3773
        if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
3774
            // offset 4; size: 2; index to XF record
3775
            $xfIndex = self::getInt2d($recordData, 4);
3776
3777
            $numValue = self::extractNumber(substr($recordData, 6, 8));
3778
3779
            $cell = $this->phpSheet->getCell($columnString . ($row + 1));
3780
            if (!$this->readDataOnly) {
3781
                // add cell style
3782
                $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
3783
            }
3784
3785
            // add cell value
3786
            $cell->setValueExplicit($numValue, Cell\DataType::TYPE_NUMERIC);
3787
        }
3788
    }
3789
3790
    /**
3791
     * Read FORMULA record + perhaps a following STRING record if formula result is a string