Total Complexity | 6 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
14 | class UserProvider implements UserProviderInterface, PasswordUpgraderInterface |
||
15 | { |
||
16 | /** |
||
17 | * @param string $username |
||
18 | * |
||
19 | * @return User|UserInterface |
||
20 | */ |
||
21 | public function loadUserByUsername(string $username) |
||
22 | { |
||
23 | $user = new User(); |
||
24 | $user->setEmail($username); |
||
25 | |||
26 | return $user; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Refreshes the user after being reloaded from the session. |
||
31 | * |
||
32 | * @param UserInterface $user |
||
33 | * |
||
34 | * @return UserInterface |
||
35 | */ |
||
36 | public function refreshUser(UserInterface $user) |
||
37 | { |
||
38 | if (!$user instanceof User) { |
||
39 | throw new UnsupportedUserException(sprintf('Invalid user class "%s".', get_class($user))); |
||
40 | } |
||
41 | |||
42 | if (empty($user->getUsername())) { |
||
43 | throw new UnsupportedUserException('Unable to find user\'s Username'); |
||
44 | } |
||
45 | |||
46 | return $user; |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * @param string $class |
||
51 | * @return bool |
||
52 | */ |
||
53 | public function supportsClass(string $class) |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * @param UserInterface $user |
||
60 | * @param string $newEncodedPassword |
||
61 | */ |
||
62 | public function upgradePassword(UserInterface $user, string $newEncodedPassword): void |
||
64 | //Not needed since no password is present; |
||
65 | } |
||
67 |