UserManager::getUser()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 1
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2016 Spomky-Labs
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license.  See the LICENSE file for details.
10
 */
11
12
namespace SpomkyLabs\TestRoleHierarchyBundle\Entity;
13
14
class UserManager
15
{
16
    protected $users = [];
17
18
    public function __construct()
19
    {
20
        $this->users['john'] = new User('john', 'doe', '0123456789', ['ROLE_SUPERVISOR']);
21
        $this->users['ben'] = new User('ben', 'neb', '9876543210', ['ROLE_MANAGER']);
22
        $this->users['ian'] = new User('ian', 'nia', '0000000000', ['ROLE_SUPERADMIN']);
23
    }
24
25
    public function checkEndUserPasswordCredentials(EndUserInterface $enduser, $password)
26
    {
27
        return $enduser->getPassword() === $password;
28
    }
29
30
    public function getUser($username)
31
    {
32
        return isset($this->users[$username]) ? $this->users[$username] : null;
33
    }
34
}
35