UserCollectionModel
class UserCollectionModel (View source)
The user collection model.
Properties
private | $users | The collection of existing user objects. | |
private | $userType | The class name of the user type. | |
private | $userTypeSerialized | The replacement for the user type class in a serialized string. |
Methods
The constructor.
Add user account.
Edit info of the currently logged in user.
Generate the PHP code for the accounts file. Basically the code returns the unserialized serialized array with all users.
Return the user collection array.
Convert legacy accounts file content.
Return a user id by name or email address.
The invalid email error message.
The invalid username error message.
Get the accounts array by including the accounts PHP file.
Verify if a given email address is valid.
Verify if a given username is valid.
Details
at line 75
__construct()
The constructor.
at line 89
bool
createUser(string $username, string $password1, string $password2, string $email, Messenger $Messenger)
Add user account.
at line 171
bool
editCurrentUserInfo(string $username, string $email, Messenger $Messenger)
Edit info of the currently logged in user.
at line 229
string
generatePHP()
Generate the PHP code for the accounts file. Basically the code returns the unserialized serialized array with all users.
That way, the accounts array can be stored as PHP. The accounts file has to be a PHP file for security reasons. When trying to access the file directly via the browser, it gets executed instead of revealing any user names.
at line 248
array
getCollection()
Return the user collection array.
at line 300
bool
sendInvitation(string $username, string $email, Messenger $Messenger)
Send invitation email.
at line 323
private string
convertLegacyAccountsFile(array $contents)
Convert legacy accounts file content.
at line 343
private int|null
getUserId(string $nameOrEmail)
Return a user id by name or email address.
at line 358
private string
invalidEmailError()
The invalid email error message.
at line 367
private string
invalidUsernameError()
The invalid username error message.
at line 377
private array
load()
Get the accounts array by including the accounts PHP file.
at line 404
private bool
validEmail(string $email = '')
Verify if a given email address is valid.
at line 416
private bool
validUsername(string $username)
Verify if a given username is valid.