Code Duplication    Length = 32-34 lines in 2 locations

src/PhpSpreadsheet/Reader/Xls.php 2 locations

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