Completed
Pull Request — master (#144)
by Serhii
24:57
created

ClientRepository::isBanned()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 8
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 10
ccs 8
cts 8
cp 1
crap 1
rs 9.4285
1
<?php
2
3
namespace AppBundle\Repository;
4
5
class ClientRepository extends \Doctrine\ORM\EntityRepository
6
{
7
    /**
8
     * @param string $ip
9
     *
10
     * @return bool
11
     */
12 99
    public function isBanned($ip) : bool
13
    {
14 99
        return null !== $this->createQueryBuilder('c')
15 99
            ->select('c')
16 99
            ->where('c.ip = :param')
17 99
            ->andWhere('c.banned = 1')
18 99
            ->setParameter(':param', $ip)
19 99
            ->getQuery()
20 99
            ->getOneOrNullResult();
21
    }
22
}
23