Code Duplication    Length = 32-34 lines in 2 locations

src/PhpSpreadsheet/Reader/Excel5.php 2 locations

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