Authenticator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 9
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getUser() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\Bundle\ApiAuthBundle\Security\ApiKey;
6
7
use Damax\Bundle\ApiAuthBundle\Security\AbstractAuthenticator;
8
use Symfony\Component\Security\Core\User\UserInterface;
9
use Symfony\Component\Security\Core\User\UserProviderInterface;
10
11
final class Authenticator extends AbstractAuthenticator
12
{
13
    public function getUser($credentials, UserProviderInterface $provider): UserInterface
14
    {
15
        if ($provider instanceof ApiKeyUserProvider) {
16
            return $provider->loadUserByApiKey($credentials);
17
        }
18
19
        return $provider->loadUserByUsername($credentials);
20
    }
21
}
22