Code Duplication    Length = 32-34 lines in 2 locations

src/PhpSpreadsheet/Reader/Excel5.php 2 locations

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