Code Duplication    Length = 13-15 lines in 2 locations

src/PhpSpreadsheet/ReferenceHelper.php 2 locations

@@ 699-711 (lines=13) @@
696
                        $modified4 = $this->updateCellReference($match[4], $pBefore, $pNumCols, $pNumRows);
697
698
                        if ($match[3] . $match[4] !== $modified3 . $modified4) {
699
                            if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) {
700
                                $toString = ($match[2] > '') ? $match[2] . '!' : '';
701
                                $toString .= $modified3 . ':' . $modified4;
702
                                list($column, $row) = Coordinate::coordinateFromString($match[3]);
703
                                //    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
704
                                $column = Coordinate::columnIndexFromString(trim($column, '$')) + 100000;
705
                                $row = trim($row, '$') + 10000000;
706
                                $cellIndex = $column . $row;
707
708
                                $newCellTokens[$cellIndex] = preg_quote($toString);
709
                                $cellTokens[$cellIndex] = '/(?<![A-Z]\$\!)' . preg_quote($fromString) . '(?!\d)/i';
710
                                ++$adjustCount;
711
                            }
712
                        }
713
                    }
714
                }
@@ 724-738 (lines=15) @@
721
                        $fromString .= $match[3];
722
723
                        $modified3 = $this->updateCellReference($match[3], $pBefore, $pNumCols, $pNumRows);
724
                        if ($match[3] !== $modified3) {
725
                            if (($match[2] == '') || (trim($match[2], "'") == $sheetName)) {
726
                                $toString = ($match[2] > '') ? $match[2] . '!' : '';
727
                                $toString .= $modified3;
728
                                list($column, $row) = Coordinate::coordinateFromString($match[3]);
729
                                //    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
730
                                $column = Coordinate::columnIndexFromString(trim($column, '$')) + 100000;
731
                                $row = trim($row, '$') + 10000000;
732
                                $cellIndex = $row . $column;
733
734
                                $newCellTokens[$cellIndex] = preg_quote($toString);
735
                                $cellTokens[$cellIndex] = '/(?<![A-Z\$\!])' . preg_quote($fromString) . '(?!\d)/i';
736
                                ++$adjustCount;
737
                            }
738
                        }
739
                    }
740
                }
741
                if ($adjustCount > 0) {