Code Duplication    Length = 14-16 lines in 2 locations

src/AppBundle/Repository/CommentRepository.php 2 locations

@@ 15-28 (lines=14) @@
12
 */
13
class CommentRepository extends EntityRepository
14
{
15
    public function getRecentComments($page = 1, $max = 5)
16
    {
17
        $first = $max * ($page - 1);
18
        $query = $this->createQueryBuilder('c')
19
            ->select('c, a, u')
20
            ->join('c.article', 'a')
21
            ->join('c.user', 'u')
22
            ->orderBy('c.createdAt', 'DESC')
23
            ->setFirstResult($first)
24
            ->setMaxResults($max)
25
            ->getQuery();
26
27
        return new PaginatorWithPages($query, $fetchJoinCollection = true);
28
    }
29
30
    public function getArticleComment($slug, $page = 1, $max = 5)
31
    {
@@ 30-45 (lines=16) @@
27
        return new PaginatorWithPages($query, $fetchJoinCollection = true);
28
    }
29
30
    public function getArticleComment($slug, $page = 1, $max = 5)
31
    {
32
        $first = $max * ($page - 1);
33
        $query = $this->createQueryBuilder('c')
34
            ->select('c, a, u')
35
            ->join('c.article', 'a')
36
            ->where('a.slug = ?1')
37
            ->join('c.user', 'u')
38
            ->orderBy('c.createdAt', 'DESC')
39
            ->setFirstResult($first)
40
            ->setMaxResults($max)
41
            ->setParameter(1, $slug)
42
            ->getQuery();
43
44
        return new PaginatorWithPages($query, $fetchJoinCollection = true);
45
    }
46
47
    public function getCountComments()
48
    {