Code Duplication    Length = 13-14 lines in 2 locations

src/AppBundle/Repository/ArticleRepository.php 2 locations

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