Code Duplication    Length = 25-25 lines in 2 locations

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

@@ 179-203 (lines=25) @@
176
     *
177
     * @return int Pointer to the end of the description or false
178
     */
179
    private function getCommentDescriptionEndPointer(): int
180
    {
181
        $descriptionStartPtr = $this->getCommentDescriptionStartPointer();
182
183
        $commentStartToken = $this->docHelper->getBlockStartToken();
184
        $commentEndPtr = $this->docHelper->getBlockEndPosition();
185
186
        //If no tags found, possible end of search is the starting tag of the doc comment.
187
        if (count($commentStartToken['comment_tags']) === 0) {
188
            return $this->file->findPrevious(
189
                [T_DOC_COMMENT_STRING],
190
                $commentEndPtr - 1,
191
                $descriptionStartPtr
192
            );
193
        }
194
195
        //else its the pointer of the first comment tag found.
196
        $firstTagPtr = array_shift($commentStartToken['comment_tags']);
197
198
        return $this->file->findPrevious(
199
            [T_DOC_COMMENT_STRING],
200
            $firstTagPtr - 1,
201
            $descriptionStartPtr
202
        );
203
    }
204
205
    /**
206
     * Returns pointer to the start of the long description or false if not found.
@@ 210-234 (lines=25) @@
207
     *
208
     * @return int Pointer to the start of the description or -1
209
     */
210
    private function getCommentDescriptionStartPointer(): int
211
    {
212
        $commentStartToken = $this->docHelper->getBlockStartToken();
213
        $commentEndPtr = $this->docHelper->getBlockEndPosition();
214
215
        $summaryPtr = $this->summaryHelper->getCommentSummaryPosition();
216
217
        //If no tags the possible end of search is the closing tag of the doc comment.
218
        if (count($commentStartToken['comment_tags']) === 0) {
219
            return $this->file->findNext(
220
                [T_DOC_COMMENT_STRING],
221
                $summaryPtr + 1,
222
                $commentEndPtr
223
            );
224
        }
225
226
        //else its the pointer of the first comment tag found.
227
        $firstTagPtr = array_shift($commentStartToken['comment_tags']);
228
229
        return $this->file->findNext(
230
            [T_DOC_COMMENT_STRING],
231
            $summaryPtr + 1,
232
            $firstTagPtr - 1
233
        );
234
    }
235
236
    /**
237
     * Adds error when description is not found.