Completed
Push — feature/auth-multi-strategy-co... ( 0e8a44 )
by
unknown
63:21
created

AuthenticationProviderDummy::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Simple dummy provider for test cases.
4
 */
5
namespace Graviton\SecurityBundle\Authentication\Provider;
6
7
use Symfony\Component\Security\Core\User\UserInterface;
8
9
/**
10
 * Class AirlockAuthenticationKeyConsultantProvider
11
 *
12
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
13
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
14
 * @link     http://swisscom.ch
15
 */
16
class AuthenticationProviderDummy extends AuthenticationProvider
17
{
18
19
    /**
20
     * AuthenticationProviderDummy constructor.
21
     */
22
    public function __construct()
23
    {
24
    }
25
26
    /**
27
     * Dummy loader for test case
28
     *
29
     * This method must throw UsernameNotFoundException if the user is not
30
     * found.
31
     *
32
     * @param string $username the consultants username
33
     *
34
     * @return false|UserInterface
35
     */
36
    public function loadUserByUsername($username)
37
    {
38
        if ($username !== 'testUsername') {
39
            return false;
40
        }
41
42
        /** @var UserInterface $user */
43
        $user = new \stdClass();
44
        $user->id = 123;
45
        $user->username = $username;
46
        $user->firstName = 'aName';
47
        $user->lastName = 'aSurname';
48
49
        return $user;
50
    }
51
}
52