CityRepository   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A countAll() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Repository;
6
7
use App\Entity\City;
8
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
9
use Doctrine\Persistence\ManagerRegistry;
10
11
/**
12
 * @method city|null find($id, $lockMode = null, $lockVersion = null)
13
 * @method city|null findOneBy(array $criteria, array $orderBy = null)
14
 * @method city[]    findAll()
15
 * @method city[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
16
 */
17
final class CityRepository extends ServiceEntityRepository
18
{
19
    public function __construct(ManagerRegistry $registry)
20
    {
21
        parent::__construct($registry, City::class);
22
    }
23
24
    public function countAll(): int
25
    {
26
        $count = $this->createQueryBuilder('l')
27
            ->select('count(l.id)')
28
            ->getQuery()
29
            ->getSingleScalarResult();
30
31
        return (int) $count;
32
    }
33
}
34