Users
extends Model
in package
Users Class
Table of Contents
- $db : Database
- Contains the Database instance
- __construct() : mixed
- Constructor
- __destruct() : mixed
- Destructor
- checkEmail() : array<string|int, mixed>
- Check if the email exists
- checkUser() : array<string|int, mixed>
- Check if the user exists, returns true if it does, false if the user doesn't exist
- checkUsername() : array<string|int, mixed>
- Check if the username exists
- deleteMoonById() : void
- Delete a moon by ID
- deletePlanetById() : void
- Delete a planet by ID
- deleteSessionByUserId() : void
- Delete a session by user ID
- getAllAlliances() : array<string|int, mixed>
- Get all alliances from the server
- getAllMoonsData() : array<string|int, mixed>
- Get all moons data based on the provided data
- getAllPlanetsByUserId() : array<string|int, mixed>
- Get all planets by User ID
- getAllPlanetsData() : array<string|int, mixed>
- Get all planets data based on the provided data
- getAllUsers() : array<string|int, mixed>
- Get all users
- getUserDataById() : array<string|int, mixed>
- Get the user data with the provided user ID
- saveBuildings() : void
- Save the planet buildings
- saveDefenses() : void
- Save the planet defenses
- savePlanet() : void
- Save the planet data
- savePremium() : void
- Save the premium for the current user
- saveShips() : void
- Save the planet ships
- saveTechnologies() : void
- Save the technologies for the current user
- saveUserData() : void
- Update user data
- saveUserPreferences() : void
- Save current user preferences
- softDeleteMoonById() : void
- Set a moon as destroyed
- softDeletePlanetById() : void
- Set a planet as destroyed and its related moon if there's any
- setNewDb() : void
- Creates a new Database object
Properties
$db
Contains the Database instance
protected
Database
$db
Methods
__construct()
Constructor
public
__construct() : mixed
Return values
mixed —__destruct()
Destructor
public
__destruct() : mixed
Return values
mixed —checkEmail()
Check if the email exists
public
checkEmail(string $email, int $user_id) : array<string|int, mixed>
Parameters
- $email : string
- $user_id : int
Return values
array<string|int, mixed> —checkUser()
Check if the user exists, returns true if it does, false if the user doesn't exist
public
checkUser(string $user) : array<string|int, mixed>
Parameters
- $user : string
Return values
array<string|int, mixed> —checkUsername()
Check if the username exists
public
checkUsername(string $username, int $user_id) : array<string|int, mixed>
Parameters
- $username : string
- $user_id : int
Return values
array<string|int, mixed> —deleteMoonById()
Delete a moon by ID
public
deleteMoonById(int $moon_id) : void
Parameters
- $moon_id : int
Return values
void —deletePlanetById()
Delete a planet by ID
public
deletePlanetById(int $planet_id) : void
Parameters
- $planet_id : int
Return values
void —deleteSessionByUserId()
Delete a session by user ID
public
deleteSessionByUserId(int $user_id) : void
Parameters
- $user_id : int
Return values
void —getAllAlliances()
Get all alliances from the server
public
getAllAlliances() : array<string|int, mixed>
Return values
array<string|int, mixed> —getAllMoonsData()
Get all moons data based on the provided data
public
getAllMoonsData(int $user_id, int $moon_id[, string $edit = '' ]) : array<string|int, mixed>
Parameters
- $user_id : int
- $moon_id : int
- $edit : string = ''
Return values
array<string|int, mixed> —getAllPlanetsByUserId()
Get all planets by User ID
public
getAllPlanetsByUserId(int $user_id) : array<string|int, mixed>
Parameters
- $user_id : int
Return values
array<string|int, mixed> —getAllPlanetsData()
Get all planets data based on the provided data
public
getAllPlanetsData(int $user_id, int $planet_id[, string $edit = '' ]) : array<string|int, mixed>
Parameters
- $user_id : int
- $planet_id : int
- $edit : string = ''
Return values
array<string|int, mixed> —getAllUsers()
Get all users
public
getAllUsers() : array<string|int, mixed>
Return values
array<string|int, mixed> —getUserDataById()
Get the user data with the provided user ID
public
getUserDataById(int $user_id) : array<string|int, mixed>
Parameters
- $user_id : int
Return values
array<string|int, mixed> —saveBuildings()
Save the planet buildings
public
saveBuildings(array<string|int, mixed> $buildings, int $planet_id) : void
Parameters
- $buildings : array<string|int, mixed>
- $planet_id : int
Return values
void —saveDefenses()
Save the planet defenses
public
saveDefenses(array<string|int, mixed> $defenses, int $planet_id) : void
Parameters
- $defenses : array<string|int, mixed>
- $planet_id : int
Return values
void —savePlanet()
Save the planet data
public
savePlanet(array<string|int, mixed> $planet_data, int $planet_id) : void
Parameters
- $planet_data : array<string|int, mixed>
- $planet_id : int
Return values
void —savePremium()
Save the premium for the current user
public
savePremium(array<string|int, mixed> $premium_data, int $user_id, array<string|int, mixed> $user_query) : void
Parameters
- $premium_data : array<string|int, mixed>
- $user_id : int
- $user_query : array<string|int, mixed>
Return values
void —saveShips()
Save the planet ships
public
saveShips(array<string|int, mixed> $ships, int $planet_id) : void
Parameters
- $ships : array<string|int, mixed>
- $planet_id : int
Return values
void —saveTechnologies()
Save the technologies for the current user
public
saveTechnologies(array<string|int, mixed> $technologies, int $user_id) : void
Parameters
- $technologies : array<string|int, mixed>
- $user_id : int
Return values
void —saveUserData()
Update user data
public
saveUserData(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>
Return values
void —saveUserPreferences()
Save current user preferences
public
saveUserPreferences(array<string|int, mixed> $post, int $user_id, array<string|int, mixed> $current_user) : void
Parameters
- $post : array<string|int, mixed>
- $user_id : int
- $current_user : array<string|int, mixed>
Return values
void —softDeleteMoonById()
Set a moon as destroyed
public
softDeleteMoonById(int $moon_id) : void
Parameters
- $moon_id : int
Return values
void —softDeletePlanetById()
Set a planet as destroyed and its related moon if there's any
public
softDeletePlanetById(int $planet_id) : void
Parameters
- $planet_id : int
Return values
void —setNewDb()
Creates a new Database object
private
setNewDb() : void