Code Duplication    Length = 13-15 lines in 2 locations

src/PhpSpreadsheet/ReferenceHelper.php 2 locations

@@ 693-705 (lines=13) @@
690
                        $modified4 = $this->updateCellReference($match[4], $pBefore, $pNumCols, $pNumRows);
691
692
                        if ($match[3] . $match[4] !== $modified3 . $modified4) {
693
                            if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) {
694
                                $toString = ($match[2] > '') ? $match[2] . '!' : '';
695
                                $toString .= $modified3 . ':' . $modified4;
696
                                list($column, $row) = Coordinate::coordinateFromString($match[3]);
697
                                //    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
698
                                $column = Coordinate::columnIndexFromString(trim($column, '$')) + 100000;
699
                                $row = trim($row, '$') + 10000000;
700
                                $cellIndex = $column . $row;
701
702
                                $newCellTokens[$cellIndex] = preg_quote($toString);
703
                                $cellTokens[$cellIndex] = '/(?<![A-Z]\$\!)' . preg_quote($fromString) . '(?!\d)/i';
704
                                ++$adjustCount;
705
                            }
706
                        }
707
                    }
708
                }
@@ 718-732 (lines=15) @@
715
                        $fromString .= $match[3];
716
717
                        $modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows);
718
                        if ($match[3] !== $modified3) {
719
                            if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) {
720
                                $toString = ($match[2] > '') ? $match[2] . '!' : '';
721
                                $toString .= $modified3;
722
                                list($column, $row) = Coordinate::coordinateFromString($match[3]);
723
                                //    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
724
                                $column = Coordinate::columnIndexFromString(trim($column, '$')) + 100000;
725
                                $row = trim($row, '$') + 10000000;
726
                                $cellIndex = $row . $column;
727
728
                                $newCellTokens[$cellIndex] = preg_quote($toString);
729
                                $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])' . preg_quote($fromString) . '(?!\d)/i';
730
                                ++$adjustCount;
731
                            }
732
                        }
733
                    }
734
                }
735
                if ($adjustCount > 0) {