Alliance
extends Model
in package
Alliance Class
Table of Contents
- $db : Database
- Contains the Database instance
- __construct() : mixed
- Constructor
- __destruct() : mixed
- Destructor
- addUserToAlliance() : void
- Add an user to the alliance
- cancelUserRequestById() : mixed
- Cancel user request
- checkAllianceName() : array<string|int, mixed>
- Check alliance name
- checkAllianceTag() : array<string|int, mixed>
- Check alliance tag
- createNewAlliance() : void
- Create a new alliance with the provided params
- createNewUserRequest() : mixed
- Update users table to set the alliance request
- deleteAlliance() : mixed
- exitAlliance() : mixed
- Exit alliance
- getAllianceDataById() : array<string|int, mixed>
- Get Alliance Data By ID
- getAllianceMembers() : type
- Get alliance members
- getAllianceMembersById() : array<string|int, mixed>
- Get alliance members filtered by alliance ID
- getAllianceMembersByIdAndRankId() : array<string|int, mixed>
- Get alliance members filtered by alliance ID and Rank ID
- getAllianceRequests() : array<string|int, mixed>
- Add an user to the alliance
- getAllianceRequestsCount() : type
- removeUserFromAlliance() : void
- Remove user from alliance
- searchAllianceByNameTag() : array<string|int, mixed>
- Search an alliance by name or tag
- transferAlliance() : void
- updateAllianceDescription() : void
- updateAllianceName() : mixed
- updateAllianceRanks() : mixed
- Update alliance ranks
- updateAllianceRequestText() : void
- updateAllianceSettings() : void
- Update alliance settings
- updateAllianceTag() : mixed
- updateAllianceText() : void
- updateUserRank() : mixed
- returnSort() : string
- Return the sort method
- 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 —addUserToAlliance()
Add an user to the alliance
public
addUserToAlliance(int $user_id, int $alliance_id) : void
Parameters
- $user_id : int
-
User ID
- $alliance_id : int
-
Alliance ID
Return values
void —cancelUserRequestById()
Cancel user request
public
cancelUserRequestById(int $user_id) : mixed
Parameters
- $user_id : int
-
User ID
Tags
Return values
mixed —checkAllianceName()
Check alliance name
public
checkAllianceName(string $alliance_name) : array<string|int, mixed>
Parameters
- $alliance_name : string
-
Alliance Name
Return values
array<string|int, mixed> —checkAllianceTag()
Check alliance tag
public
checkAllianceTag(string $alliance_tag) : array<string|int, mixed>
Parameters
- $alliance_tag : string
-
Alliance Tag
Return values
array<string|int, mixed> —createNewAlliance()
Create a new alliance with the provided params
public
createNewAlliance(string $alliance_name, string $alliance_tag, int $user_id, string $founder_rank, string $newcomer_rank) : void
Parameters
- $alliance_name : string
-
Alliance Name
- $alliance_tag : string
-
Alliance Tag
- $user_id : int
-
User ID
- $founder_rank : string
-
Founder Rank
- $newcomer_rank : string
-
New member Rank
Return values
void —createNewUserRequest()
Update users table to set the alliance request
public
createNewUserRequest(int $alliance_id, string $text, int $user_id) : mixed
Parameters
- $alliance_id : int
-
Alliance ID
- $text : string
-
Request Text
- $user_id : int
-
User ID
Tags
Return values
mixed —deleteAlliance()
public
deleteAlliance(int $alliance_id) : mixed
Parameters
- $alliance_id : int
-
Alliance ID
Return values
mixed —exitAlliance()
Exit alliance
public
exitAlliance(mixed $alliance_id, int $user_id) : mixed
Parameters
- $alliance_id : mixed
- $user_id : int
-
User ID
Tags
Return values
mixed —getAllianceDataById()
Get Alliance Data By ID
public
getAllianceDataById(int $alliance_id) : array<string|int, mixed>
Parameters
- $alliance_id : int
-
Alliance ID
Return values
array<string|int, mixed> —getAllianceMembers()
Get alliance members
public
getAllianceMembers(type $alliance_id, type $sort_by_field, type $sort_by_order) : type
Parameters
- $alliance_id : type
- $sort_by_field : type
- $sort_by_order : type
Return values
type —getAllianceMembersById()
Get alliance members filtered by alliance ID
public
getAllianceMembersById(int $alliance_id) : array<string|int, mixed>
Parameters
- $alliance_id : int
-
Alliance ID
Return values
array<string|int, mixed> —getAllianceMembersByIdAndRankId()
Get alliance members filtered by alliance ID and Rank ID
public
getAllianceMembersByIdAndRankId(int $alliance_id, int $rank_id) : array<string|int, mixed>
Parameters
- $alliance_id : int
-
Alliance ID
- $rank_id : int
-
Rank ID
Return values
array<string|int, mixed> —getAllianceRequests()
Add an user to the alliance
public
getAllianceRequests(int $alliance_id) : array<string|int, mixed>
Parameters
- $alliance_id : int
-
Alliance ID
Return values
array<string|int, mixed> —getAllianceRequestsCount()
public
getAllianceRequestsCount(type $alliance_id) : type
Parameters
- $alliance_id : type
Return values
type —removeUserFromAlliance()
Remove user from alliance
public
removeUserFromAlliance(int $user_id) : void
Parameters
- $user_id : int
-
User ID
Return values
void —searchAllianceByNameTag()
Search an alliance by name or tag
public
searchAllianceByNameTag(string $name_tag) : array<string|int, mixed>
Parameters
- $name_tag : string
-
Name or Tag
Return values
array<string|int, mixed> —transferAlliance()
public
transferAlliance(int $alliance_id, int $current_user_id, int $new_leader) : void
Parameters
- $alliance_id : int
-
Alliance ID
- $current_user_id : int
-
Current User ID
- $new_leader : int
-
New Leader ID
Return values
void —updateAllianceDescription()
public
updateAllianceDescription(int $alliance_id, string $text) : void
Parameters
- $alliance_id : int
-
Alliance ID
- $text : string
-
Text
Return values
void —updateAllianceName()
public
updateAllianceName(int $alliance_id, string $alliance_name) : mixed
Parameters
- $alliance_id : int
-
Alliance ID
- $alliance_name : string
-
Alliance Name
Return values
mixed —updateAllianceRanks()
Update alliance ranks
public
updateAllianceRanks(int $alliance_id, string $ranks) : mixed
Parameters
- $alliance_id : int
-
Alliance ID
- $ranks : string
-
Ranks
Return values
mixed —updateAllianceRequestText()
public
updateAllianceRequestText(int $alliance_id, string $text) : void
Parameters
- $alliance_id : int
-
Alliance ID
- $text : string
-
Text
Return values
void —updateAllianceSettings()
Update alliance settings
public
updateAllianceSettings(int $alliance_id, array<string|int, mixed> $alliance_data) : void
Parameters
- $alliance_id : int
-
Alliance ID
- $alliance_data : array<string|int, mixed>
-
Alliance Data
Return values
void —updateAllianceTag()
public
updateAllianceTag(int $alliance_id, string $alliance_tag) : mixed
Parameters
- $alliance_id : int
-
Alliance ID
- $alliance_tag : string
-
Alliance Tag
Return values
mixed —updateAllianceText()
public
updateAllianceText(int $alliance_id, string $text) : void
Parameters
- $alliance_id : int
-
Alliance ID
- $text : string
-
Text
Return values
void —updateUserRank()
public
updateUserRank(int $user_id, string $rank) : mixed
Parameters
- $user_id : int
-
User ID
- $rank : string
-
Rank
Return values
mixed —returnSort()
Return the sort method
private
returnSort(int $sort_field, int $sort_order) : string
Parameters
- $sort_field : int
-
Sort by field
- $sort_order : int
-
Sort by order [ASC|DESC]
Return values
string —setNewDb()
Creates a new Database object
private
setNewDb() : void