Code Duplication    Length = 14-14 lines in 2 locations

src/PhpSpreadsheet/ReferenceHelper.php 2 locations

@@ 648-661 (lines=14) @@
645
                        $modified3 = substr($this->updateCellReference('$A' . $match[3], $pBefore, $pNumCols, $pNumRows), 2);
646
                        $modified4 = substr($this->updateCellReference('$A' . $match[4], $pBefore, $pNumCols, $pNumRows), 2);
647
648
                        if ($match[3] . ':' . $match[4] !== $modified3 . ':' . $modified4) {
649
                            if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) {
650
                                $toString = ($match[2] > '') ? $match[2] . '!' : '';
651
                                $toString .= $modified3 . ':' . $modified4;
652
                                //    Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
653
                                $column = 100000;
654
                                $row = 10000000 + trim($match[3], '$');
655
                                $cellIndex = $column . $row;
656
657
                                $newCellTokens[$cellIndex] = preg_quote($toString);
658
                                $cellTokens[$cellIndex] = '/(?<!\d\$\!)' . preg_quote($fromString) . '(?!\d)/i';
659
                                ++$adjustCount;
660
                            }
661
                        }
662
                    }
663
                }
664
                //    Search for column ranges (e.g. 'Sheet1'!C:E or C:E) with or without $ absolutes (e.g. $C:E)
@@ 673-686 (lines=14) @@
670
                        $modified3 = substr($this->updateCellReference($match[3] . '$1', $pBefore, $pNumCols, $pNumRows), 0, -2);
671
                        $modified4 = substr($this->updateCellReference($match[4] . '$1', $pBefore, $pNumCols, $pNumRows), 0, -2);
672
673
                        if ($match[3] . ':' . $match[4] !== $modified3 . ':' . $modified4) {
674
                            if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) {
675
                                $toString = ($match[2] > '') ? $match[2] . '!' : '';
676
                                $toString .= $modified3 . ':' . $modified4;
677
                                //    Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
678
                                $column = Coordinate::columnIndexFromString(trim($match[3], '$')) + 100000;
679
                                $row = 10000000;
680
                                $cellIndex = $column . $row;
681
682
                                $newCellTokens[$cellIndex] = preg_quote($toString);
683
                                $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])' . preg_quote($fromString) . '(?![A-Z])/i';
684
                                ++$adjustCount;
685
                            }
686
                        }
687
                    }
688
                }
689
                //    Search for cell ranges (e.g. 'Sheet1'!A3:C5 or A3:C5) with or without $ absolutes (e.g. $A1:C$5)