Completed
Pull Request — master (#144)
by
unknown
13:51
created

ClientRepository::isBanned()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 1
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
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
    public function isBanned($ip) : bool
13
    {
14
        return null !== $this->createQueryBuilder('c')
15
            ->select('c')
16
            ->where('c.ip = :param')
17
            ->andWhere('c.banned = 1')
18
            ->setParameter(':param', $ip)
19
            ->getQuery()
20
            ->getOneOrNullResult();
21
    }
22
}
23