Code Duplication    Length = 12-12 lines in 2 locations

src/PhpSpreadsheet/Worksheet.php 2 locations

@@ 3015-3026 (lines=12) @@
3012
                        $pValue = Shared\StringHelper::substring($pValue, 0, 29);
3013
                    }
3014
                    $i = 1;
3015
                    while ($this->getParent()->sheetCodeNameExists($pValue . '_' . $i)) {
3016
                        ++$i;
3017
                        if ($i == 10) {
3018
                            if (Shared\StringHelper::countCharacters($pValue) > 28) {
3019
                                $pValue = Shared\StringHelper::substring($pValue, 0, 28);
3020
                            }
3021
                        } elseif ($i == 100) {
3022
                            if (Shared\StringHelper::countCharacters($pValue) > 27) {
3023
                                $pValue = Shared\StringHelper::substring($pValue, 0, 27);
3024
                            }
3025
                        }
3026
                    }
3027
3028
                    $pValue = $pValue . '_' . $i; // ok, we have a valid name
3029
                }
@@ 861-872 (lines=12) @@
858
                        $pValue = Shared\StringHelper::substring($pValue, 0, 29);
859
                    }
860
                    $i = 1;
861
                    while ($this->parent->sheetNameExists($pValue . ' ' . $i)) {
862
                        ++$i;
863
                        if ($i == 10) {
864
                            if (Shared\StringHelper::countCharacters($pValue) > 28) {
865
                                $pValue = Shared\StringHelper::substring($pValue, 0, 28);
866
                            }
867
                        } elseif ($i == 100) {
868
                            if (Shared\StringHelper::countCharacters($pValue) > 27) {
869
                                $pValue = Shared\StringHelper::substring($pValue, 0, 27);
870
                            }
871
                        }
872
                    }
873
874
                    $pValue .= " $i";
875
                }