BadgeRepository   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 5
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A countAll() 0 10 1
1
<?php
2
3
namespace Badger\Bundle\GameBundle\Doctrine\Repository;
4
5
use Badger\Component\Game\Repository\BadgeRepositoryInterface;
6
use Doctrine\ORM\EntityRepository;
7
8
/**
9
 * Doctrine implementation of repository for Badge entities.
10
 *
11
 * @author  Adrien Pétremann <[email protected]>
12
 * @license http://opensource.org/licenses/MIT The MIT License (MIT)
13
 */
14
class BadgeRepository extends EntityRepository implements BadgeRepositoryInterface
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function countAll()
20
    {
21
        $qb = $this->getEntityManager()->createQueryBuilder();
22
        $qb->select($qb->expr()->count('b'))
23
            ->from('GameBundle:Badge', 'b');
24
25
        $query = $qb->getQuery();
26
27
        return $query->getSingleScalarResult();
28
    }
29
}
30