Code Duplication    Length = 12-13 lines in 2 locations

src/Repository/Database/PostRepository.php 2 locations

@@ 48-59 (lines=12) @@
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function byCategoryCount($slug)
49
    {
50
        $qb = $this->createQueryBuilder('p');
51
52
        $query = $qb->select('count(p.id)')
53
            ->join('p.category', 'c')
54
            ->where($qb->expr()->eq('c.slug', ':category'))
55
            ->setParameter(':category', $slug)
56
            ->getQuery();
57
58
        return $query->getSingleScalarResult();
59
    }
60
61
    /**
62
     * {@inheritdoc}
@@ 64-76 (lines=13) @@
61
    /**
62
     * {@inheritdoc}
63
     */
64
    public function byCategory($slug, Criteria $criteria)
65
    {
66
        $qb = $this->createQueryBuilder('p');
67
68
        $query = $qb->join('p.category', 'c')
69
            ->where($qb->expr()->eq('c.slug', ':category'))
70
            ->setParameter(':category', $slug)
71
            ->orderBy('p.published_at', 'DESC')
72
            ->addCriteria($criteria)
73
            ->getQuery();
74
75
        return $query->getResult();
76
    }
77
78
    public function byTagCount($slug)
79
    {