Code Duplication    Length = 13-14 lines in 2 locations

src/AppBundle/Repository/ArticleRepository.php 2 locations

@@ 47-60 (lines=14) @@
44
            ->getSingleResult();
45
    }
46
47
    public function getArticleWithCountComment($slug)
48
    {
49
        return $this->createQueryBuilder('a')
50
            ->select('a, c, t, u, count(cm.id) as countComments')
51
            ->leftJoin('a.categories', 'c')
52
            ->leftJoin('a.tags', 't')
53
            ->leftJoin('a.comments', 'cm')
54
            ->join('a.user', 'u')
55
            ->where('a.slug = ?1')
56
            ->groupBy('a, c, t, u')
57
            ->setParameter(1, $slug)
58
            ->getQuery()
59
            ->getSingleResult();
60
    }
61
62
    public function getArticlesSorted($sortBy, $param, $page = 1, $max = 10)
63
    {
@@ 109-121 (lines=13) @@
106
107
    }
108
109
    public function getPopularArticles($max = 5)
110
    {
111
        return $this->createQueryBuilder('a')
112
            ->select('a, u, avg(c.rating) as rating')
113
            ->leftJoin('a.comments', 'c')
114
            ->join('a.user', 'u')
115
            ->groupBy('a, u')
116
            ->orderBy('rating', 'DESC')
117
            ->setFirstResult(0)
118
            ->setMaxResults($max)
119
            ->getQuery()
120
            ->getResult();
121
    }
122
123
    public function getRecentArticles($max = 5)
124
    {