Code Duplication    Length = 16-18 lines in 2 locations

src/Standards/BestIt/Sniffs/Commenting/MethodDocSniff.php 2 locations

@@ 197-212 (lines=16) @@
194
        }
195
196
        // No extra newline before short description.
197
        if ($tokens[$short]['line'] !== ($tokens[$stackPtr]['line'] + 1)) {
198
            $error = self::MESSAGE_CODE_SPACING_BEFORE;
199
            $fix = $phpcsFile->addFixableError($error, $short, self::CODE_SPACING_BEFORE_SHORT);
200
            if ($fix === true) {
201
                $phpcsFile->fixer->beginChangeset();
202
                for ($i = $stackPtr; $i < $short; $i++) {
203
                    if ($tokens[$i]['line'] === $tokens[$stackPtr]['line']) {
204
                        continue;
205
                    } elseif ($tokens[$i]['line'] === $tokens[$short]['line']) {
206
                        break;
207
                    }
208
                    $phpcsFile->fixer->replaceToken($i, '');
209
                }
210
                $phpcsFile->fixer->endChangeset();
211
            }
212
        }
213
214
        $shortContent = $tokens[$short]['content'];
215
        $shortEnd = $short;
@@ 232-249 (lines=18) @@
229
230
        $long = $phpcsFile->findNext($empty, $shortEnd + 1, $commentEnd - 1, true);
231
        if ($long !== false && $tokens[$long]['code'] === T_DOC_COMMENT_STRING) {
232
            if ($tokens[$long]['line'] !== ($tokens[$shortEnd]['line'] + 2)) {
233
                $error = self::MESSAGE_SPACING_BETWEEN;
234
                $fix   = $phpcsFile->addFixableError($error, $long, self::CODE_SPACING_BETWEEN);
235
                if ($fix === true) {
236
                    $phpcsFile->fixer->beginChangeset();
237
                    for ($i = ($shortEnd + 1); $i < $long; $i++) {
238
                        if ($tokens[$i]['line'] === $tokens[$shortEnd]['line']) {
239
                            continue;
240
                        } elseif ($tokens[$i]['line'] === ($tokens[$long]['line'] - 1)) {
241
                            break;
242
                        }
243
244
                        $phpcsFile->fixer->replaceToken($i, '');
245
                    }
246
247
                    $phpcsFile->fixer->endChangeset();
248
                }
249
            }
250
251
            if (preg_match('/^\p{Ll}/u', $tokens[$long]['content']) === 1) {
252
                $error = self::MESSAGE_LONG_NOT_CAPITAL;