Code Duplication    Length = 25-25 lines in 2 locations

src/Standards/BestIt/CodeSniffer/Helper/DocDescriptionHelper.php 2 locations

@@ 216-240 (lines=25) @@
213
     *
214
     * @return int Pointer to the end of the description or false
215
     */
216
    private function getCommentDescriptionEndPointer(): int
217
    {
218
        $descriptionStartPtr = $this->getCommentDescriptionStartPointer();
219
220
        $commentStartToken = $this->docHelper->getCommentStartToken();
221
        $commentEndPtr = $this->docHelper->getCommentEndPointer();
222
223
        //If no tags found, possible end of search is the starting tag of the doc comment.
224
        if (count($commentStartToken['comment_tags']) === 0) {
225
            return $this->file->findPrevious(
226
                [T_DOC_COMMENT_STRING],
227
                $commentEndPtr - 1,
228
                $descriptionStartPtr
229
            );
230
        }
231
232
        //else its the pointer of the first comment tag found.
233
        $firstTagPtr = array_shift($commentStartToken['comment_tags']);
234
235
        return $this->file->findPrevious(
236
            [T_DOC_COMMENT_STRING],
237
            $firstTagPtr - 1,
238
            $descriptionStartPtr
239
        );
240
    }
241
242
    /**
243
     * Returns pointer to the start of the long description or false if not found.
@@ 247-271 (lines=25) @@
244
     *
245
     * @return int Pointer to the start of the description or -1
246
     */
247
    private function getCommentDescriptionStartPointer(): int
248
    {
249
        $commentStartToken = $this->docHelper->getCommentStartToken();
250
        $commentEndPtr = $this->docHelper->getCommentEndPointer();
251
252
        $summaryPtr = $this->summaryHelper->getCommentSummaryPointer();
253
254
        //If no tags the possible end of search is the closing tag of the doc comment.
255
        if (count($commentStartToken['comment_tags']) === 0) {
256
            return $this->file->findNext(
257
                [T_DOC_COMMENT_STRING],
258
                $summaryPtr + 1,
259
                $commentEndPtr
260
            );
261
        }
262
263
        //else its the pointer of the first comment tag found.
264
        $firstTagPtr = array_shift($commentStartToken['comment_tags']);
265
266
        return $this->file->findNext(
267
            [T_DOC_COMMENT_STRING],
268
            $summaryPtr + 1,
269
            $firstTagPtr - 1
270
        );
271
    }
272
273
    /**
274
     * Adds error when description is not found.