Test Failed
Push — develop ( 28e0cd...307ddb )
by Daniel
05:05
created

UserChecker   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 7
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A checkPostAuth() 0 7 3
A checkPreAuth() 0 4 2
1
<?php
2
3
namespace Silverback\ApiComponentBundle\Security;
4
5
use Silverback\ApiComponentBundle\Entity\User\User;
6
use Silverback\ApiComponentBundle\Exception\UserDisabledException;
7
use Symfony\Component\Security\Core\User\UserCheckerInterface;
8
use Symfony\Component\Security\Core\User\UserInterface;
9
10
class UserChecker implements UserCheckerInterface
11
{
12
    /**
13
     * @param UserInterface $user
14
     */
15
    public function checkPreAuth(UserInterface $user): void
16
    {
17
        if (!$user instanceof User) {
18
            return;
19
        }
20
    }
21
22
    /**
23
     * @param UserInterface $user
24
     */
25
    public function checkPostAuth(UserInterface $user): void
26
    {
27
        if (!$user instanceof User) {
28
            return;
29
        }
30
        if (!$user->isEnabled()) {
31
            throw new UserDisabledException('Your account is not currently enabled.');
32
        }
33
    }
34
}
35