Failed Conditions
Push — master ( cccd95...989cb2 )
by Florent
03:57
created

UserManager::isPasswordCredentialValid()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 2
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\SecurityBundle\Tests\TestBundle\Entity;
15
16
use OAuth2Framework\Component\Core\UserAccount\UserAccount;
17
use OAuth2Framework\Component\Core\UserAccount\UserAccountManager;
18
19
class UserManager implements UserAccountManager
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function isPasswordCredentialValid(UserAccount $user, string $password): bool
25
    {
26
        if (!$user instanceof User) {
27
            return false;
28
        }
29
30
        return in_array($password, $user->getOAuth2Passwords());
31
    }
32
}
33