Account
in package
FinalYes
Account class
This class is a helper for managing user sessions.
Table of Contents
Methods
- __get() : bool|null
- Magic getter method to provide a shortcut for getting account status.
- isGuest() : bool
- Checks if the user is a guest.
- login() : bool
- Logs a user in.
- logout() : void
- Logs the user out.
Methods
__get()
Magic getter method to provide a shortcut for getting account status.
public
__get(string $name) : bool|null
Parameters
- $name : string
-
The name of the property to get.
Tags
Return values
bool|null —The value of the property if found, null otherwise.
isGuest()
Checks if the user is a guest.
public
static isGuest() : bool
Return values
bool —true if the user is a guest, false otherwise
login()
Logs a user in.
public
login(UserModel $user) : bool
Parameters
- $user : UserModel
-
The user to log in.
Return values
bool —true if the user was successfully logged in, false otherwise.
logout()
Logs the user out.
public
logout() : void
This method will remove the user's session, effectively logging them out.