1 | <?php |
||
20 | class UsersTable { |
||
21 | |||
22 | use \Elgg\TimeUsing; |
||
23 | |||
24 | /** |
||
25 | * @var Conf |
||
26 | */ |
||
27 | protected $config; |
||
28 | |||
29 | /** |
||
30 | * @var Database |
||
31 | */ |
||
32 | protected $db; |
||
33 | |||
34 | /** |
||
35 | * @var MetadataTable |
||
36 | */ |
||
37 | protected $metadata; |
||
38 | |||
39 | /** |
||
40 | * @var EntityCache |
||
41 | */ |
||
42 | protected $entity_cache; |
||
43 | |||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $table; |
||
48 | |||
49 | /** |
||
50 | * Constructor |
||
51 | * |
||
52 | * @param Conf $config Config |
||
53 | * @param Database $db Database |
||
54 | * @param MetadataTable $metadata Metadata table |
||
55 | * @param EntityCache $cache Entity cache |
||
56 | */ |
||
57 | 3711 | public function __construct(Conf $config, Database $db, MetadataTable $metadata, EntityCache $cache) { |
|
63 | |||
64 | /** |
||
65 | * Get user by username |
||
66 | * |
||
67 | * @param string $username The user's username |
||
68 | * |
||
69 | * @return ElggUser|false Depending on success |
||
70 | */ |
||
71 | 286 | public function getByUsername($username) { |
|
100 | |||
101 | /** |
||
102 | * Get an array of users from an email address |
||
103 | * |
||
104 | * @param string $email Email address |
||
105 | * @return array |
||
106 | */ |
||
107 | 63 | public function getByEmail($email) { |
|
125 | |||
126 | /** |
||
127 | * Return users (or the number of them) who have been active within a recent period. |
||
128 | * |
||
129 | * @param array $options Array of options with keys: |
||
130 | * |
||
131 | * seconds (int) => Length of period (default 600 = 10min) |
||
132 | * limit (int) => Limit (default 10) |
||
133 | * offset (int) => Offset (default 0) |
||
134 | * count (bool) => Return a count instead of users? (default false) |
||
135 | * |
||
136 | * @return \ElggUser[]|int |
||
137 | */ |
||
138 | public function findActive(array $options = []) { |
||
176 | |||
177 | /** |
||
178 | * Registers a user, returning false if the username already exists |
||
179 | * |
||
180 | * @param string $username The username of the new user |
||
181 | * @param string $password The password |
||
182 | * @param string $name The user's display name |
||
183 | * @param string $email The user's email address |
||
184 | * @param bool $allow_multiple_emails Allow the same email address to be |
||
185 | * registered multiple times? |
||
186 | * @param string $subtype Subtype of the user entity |
||
187 | * |
||
188 | * @return int|false The new user's GUID; false on failure |
||
189 | * @throws RegistrationException |
||
190 | */ |
||
191 | 63 | public function register($username, $password, $name, $email, $allow_multiple_emails = false, $subtype = null) { |
|
259 | |||
260 | /** |
||
261 | * Generates a unique invite code for a user |
||
262 | * |
||
263 | * @param string $username The username of the user sending the invitation |
||
264 | * |
||
265 | * @return string Invite code |
||
266 | * @see validateInviteCode |
||
267 | */ |
||
268 | public function generateInviteCode($username) { |
||
272 | |||
273 | /** |
||
274 | * Validate a user's invite code |
||
275 | * |
||
276 | * @param string $username The username |
||
277 | * @param string $code The invite code |
||
278 | * |
||
279 | * @return bool |
||
280 | * @see generateInviteCode |
||
281 | */ |
||
282 | public function validateInviteCode($username, $code) { |
||
292 | } |
||
293 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.