Code Duplication    Length = 10-11 lines in 2 locations

server/app/Models/Article/ArticlesSearchRepository.php 1 location

@@ 35-44 (lines=10) @@
32
     * @param int $limit
33
     * @return Collection|SearchResult[]
34
     */
35
    public function getSearchResults(string $query, int $limit = 10): Collection
36
    {
37
        return Article::query()
38
            ->where('content_source', 'LIKE', '%' . $query . '%')
39
            ->take($limit)
40
            ->get(['slug', 'title', 'content_rendered'])
41
            ->map(function (Article $model) {
42
                return $this->transform($model);
43
            });
44
    }
45
46
    /**
47
     * @param Article $article

server/app/Models/DocsPage/DocsPagesSearchRepository.php 1 location

@@ 35-45 (lines=11) @@
32
     * @param int $limit
33
     * @return Collection|SearchResult[]
34
     */
35
    public function getSearchResults(string $query, int $limit = 10): Collection
36
    {
37
        return DocsPage::query()
38
            ->with('docs')
39
            ->where('content_source', 'LIKE', '%' . $query . '%')
40
            ->take($limit)
41
            ->get(['docs_id', 'slug', 'title', 'content_rendered'])
42
            ->map(function (DocsPage $model) {
43
                return $this->transform($model);
44
            });
45
    }
46
47
    /**
48
     * @param DocsPage $page