Failed Conditions
Push — master ( 1312dd...bb342a )
by Florent
04:40
created

UserAccountManager   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 24
c 0
b 0
f 0
wmc 4
lcom 0
cbo 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isPasswordCredentialValid() 0 8 2
A getAuthenticationContextClassReferenceFor() 0 4 1
A getAuthenticationMethodReferenceFor() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2018 Spomky-Labs
9
 *
10
 * This software may be modified and distributed under the terms
11
 * of the MIT license.  See the LICENSE file for details.
12
 */
13
14
namespace OAuth2Framework\ServerBundle\Tests\TestBundle\Entity;
15
16
use OAuth2Framework\Component\Core\UserAccount\AuthenticationContextClassReferenceSupport;
17
use OAuth2Framework\Component\Core\UserAccount\AuthenticationMethodReferenceSupport;
18
use OAuth2Framework\Component\Core\UserAccount\UserAccount;
19
use OAuth2Framework\Component\Core\UserAccount\UserAccountManager as UserAccountManagerInterface;
20
21
class UserAccountManager implements UserAccountManagerInterface, AuthenticationMethodReferenceSupport, AuthenticationContextClassReferenceSupport
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function isPasswordCredentialValid(UserAccount $user, string $password): bool
27
    {
28
        if (!$user instanceof User) {
29
            return false;
30
        }
31
32
        return in_array($password, $user->getOAuth2Passwords());
33
    }
34
35
    public function getAuthenticationContextClassReferenceFor(UserAccount $user): ?string
36
    {
37
        return null;
38
    }
39
40
    public function getAuthenticationMethodReferenceFor(UserAccount $user): ?array
41
    {
42
        return null;
43
    }
44
}
45