1 | <?php |
||
26 | class InMemoryApiUserProvider implements UserProviderInterface |
||
27 | { |
||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | private $users; |
||
32 | |||
33 | /** |
||
34 | * Constructor. |
||
35 | * |
||
36 | * @param array $users The list of given users in security |
||
37 | */ |
||
38 | 30 | public function __construct(array $users = []) |
|
42 | |||
43 | /** |
||
44 | * Returns a username for a given api key. |
||
45 | * |
||
46 | * @param string $apiKey the api key |
||
47 | * |
||
48 | * @return string|null |
||
49 | */ |
||
50 | 9 | public function getUsernameByApiKey($apiKey) |
|
60 | |||
61 | /** |
||
62 | * {@inheritdoc} |
||
63 | */ |
||
64 | 6 | public function loadUserByUsername($username) |
|
70 | |||
71 | /** |
||
72 | * Adds a new User to the provider. |
||
73 | * |
||
74 | * @param UserInterface $user A UserInterface instance |
||
75 | * |
||
76 | * @throws \LogicException |
||
77 | */ |
||
78 | public function createUser(UserInterface $user) |
||
86 | 3 | ||
87 | /** |
||
88 | * {@inheritdoc} |
||
89 | */ |
||
90 | public function refreshUser(UserInterface $user) |
||
94 | |||
95 | /** |
||
96 | * {@inheritdoc} |
||
97 | */ |
||
98 | public function supportsClass($class) |
||
102 | |||
103 | /** |
||
104 | * Returns the user by given username. |
||
105 | * |
||
106 | * @param string $username the username |
||
107 | * |
||
108 | * @return User |
||
109 | */ |
||
110 | private function getUser($username) |
||
121 | } |
||
122 |