Code Duplication    Length = 10-11 lines in 2 locations

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

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

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

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