Test Setup Failed
Push — master ( 72a408...3f5e9b )
by Alexey
02:46
created

AccountRepository::findLinkedAccountsBy()   B

Complexity

Conditions 6
Paths 16

Size

Total Lines 28
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 42

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 28
ccs 0
cts 18
cp 0
rs 8.439
cc 6
eloc 15
nc 16
nop 4
crap 42

1 Method

Rating   Name   Duplication   Size   Complexity  
A AccountRepository::getLinkedAccountsCount() 0 8 1
1
<?php
2
3
namespace Skobkin\Bundle\PointToolsBundle\Repository\Telegram;
4
5
use Doctrine\ORM\EntityRepository;
6
use Skobkin\Bundle\PointToolsBundle\Entity\Telegram\Account;
7
8
class AccountRepository extends EntityRepository
9
{
10
    public function add(Account $entity): void
11
    {
12
        $this->getEntityManager()->persist($entity);
13
    }
14
15
    /**
16
     * Returns total number of accounts
17
     *
18
     * @return int
19
     */
20
    public function getAccountsCount(): int
21
    {
22
        return $this->createQueryBuilder('a')
23
            ->select('COUNT(a)')
24
            ->getQuery()->getSingleScalarResult()
25
        ;
26
    }
27
28
    /**
29
     * Returns number of accounts with linked Point.im profile
30
     *
31
     * @return int
32
     */
33
    public function getLinkedAccountsCount(): int
34
    {
35
        return $this->createQueryBuilder('a')
36
            ->select('COUNT(a)')
37
            ->where('a.user IS NOT NULL')
38
            ->getQuery()->getSingleScalarResult()
39
        ;
40
    }
41
}