UserRepository   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadUserByUsername() 0 9 1
1
<?php
2
3
namespace ClientBundle\Repository;
4
5
use Doctrine\ORM\EntityRepository;
6
use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface;
7
8
/**
9
 * Class UserRepository
10
 */
11
class UserRepository extends EntityRepository implements UserLoaderInterface
12
{
13
    /**
14
     * @param string $username
15
     * @return mixed
16
     */
17
    public function loadUserByUsername($username)
18
    {
19
        return $this->createQueryBuilder('u')
20
            ->where('u.username = :username OR u.email = :email')
21
            ->setParameter('username', $username)
22
            ->setParameter('email', $username)
23
            ->getQuery()
24
            ->getOneOrNullResult();
25
    }
26
}
27