Code Duplication    Length = 32-34 lines in 2 locations

src/PhpSpreadsheet/Reader/Xls.php 2 locations

@@ 3713-3746 (lines=34) @@
3710
     * --    "OpenOffice.org's Documentation of the Microsoft
3711
     *         Excel File Format"
3712
     */
3713
    private function readRk()
3714
    {
3715
        $length = self::getUInt2d($this->data, $this->pos + 2);
3716
        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
3717
3718
        // move stream pointer to next record
3719
        $this->pos += 4 + $length;
3720
3721
        // offset: 0; size: 2; index to row
3722
        $row = self::getUInt2d($recordData, 0);
3723
3724
        // offset: 2; size: 2; index to column
3725
        $column = self::getUInt2d($recordData, 2);
3726
        $columnString = Coordinate::stringFromColumnIndex($column + 1);
3727
3728
        // Read cell?
3729
        if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
3730
            // offset: 4; size: 2; index to XF record
3731
            $xfIndex = self::getUInt2d($recordData, 4);
3732
3733
            // offset: 6; size: 4; RK value
3734
            $rknum = self::getInt4d($recordData, 6);
3735
            $numValue = self::getIEEE754($rknum);
3736
3737
            $cell = $this->phpSheet->getCell($columnString . ($row + 1));
3738
            if (!$this->readDataOnly) {
3739
                // add style information
3740
                $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
3741
            }
3742
3743
            // add cell
3744
            $cell->setValueExplicit($numValue, DataType::TYPE_NUMERIC);
3745
        }
3746
    }
3747
3748
    /**
3749
     * Read LABELSST record
@@ 3894-3925 (lines=32) @@
3891
     * --    "OpenOffice.org's Documentation of the Microsoft
3892
     *         Excel File Format"
3893
     */
3894
    private function readNumber()
3895
    {
3896
        $length = self::getUInt2d($this->data, $this->pos + 2);
3897
        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);
3898
3899
        // move stream pointer to next record
3900
        $this->pos += 4 + $length;
3901
3902
        // offset: 0; size: 2; index to row
3903
        $row = self::getUInt2d($recordData, 0);
3904
3905
        // offset: 2; size 2; index to column
3906
        $column = self::getUInt2d($recordData, 2);
3907
        $columnString = Coordinate::stringFromColumnIndex($column + 1);
3908
3909
        // Read cell?
3910
        if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
3911
            // offset 4; size: 2; index to XF record
3912
            $xfIndex = self::getUInt2d($recordData, 4);
3913
3914
            $numValue = self::extractNumber(substr($recordData, 6, 8));
3915
3916
            $cell = $this->phpSheet->getCell($columnString . ($row + 1));
3917
            if (!$this->readDataOnly) {
3918
                // add cell style
3919
                $cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
3920
            }
3921
3922
            // add cell value
3923
            $cell->setValueExplicit($numValue, DataType::TYPE_NUMERIC);
3924
        }
3925
    }
3926
3927
    /**
3928
     * Read FORMULA record + perhaps a following STRING record if formula result is a string