UserRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A findUserByEmail() 0 3 1
A findUserByActivationToken() 0 3 1
A findUserByPasswordResetToken() 0 3 1
1
<?php
2
3
/**
4
 * (c) FSi sp. z o.o. <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace FSi\Bundle\AdminSecurityBundle\Doctrine\Repository;
13
14
use Doctrine\ORM\EntityRepository;
15
use FSi\Bundle\AdminSecurityBundle\Security\User\ActivableInterface;
16
use FSi\Bundle\AdminSecurityBundle\Security\User\ResettablePasswordInterface;
17
use FSi\Bundle\AdminSecurityBundle\Security\User\UserRepositoryInterface;
18
use Symfony\Component\Security\Core\User\UserInterface as SymfonyUserInterface;
19
20
class UserRepository extends EntityRepository implements UserRepositoryInterface
21
{
22
    public function findUserByActivationToken(string $activationToken): ?ActivableInterface
23
    {
24
        return $this->findOneBy(['activationToken.token' => $activationToken]);
25
    }
26
27
    public function findUserByPasswordResetToken(string $confirmationToken): ?ResettablePasswordInterface
28
    {
29
        return $this->findOneBy(['passwordResetToken.token' => $confirmationToken]);
30
    }
31
32
    public function findUserByEmail(string $email): ?SymfonyUserInterface
33
    {
34
        return $this->findOneBy(['email' => $email]);
35
    }
36
}
37