Buddy
in package
Buddy Class
Tags
Table of Contents
- $_buddies : array<string|int, mixed>
- $_current_user_id : int
- __construct() : void
- Constructor
- getBuddies() : array<string|int, mixed>
- Get all the players that are the current user's buddies
- getReceivedRequests() : array<string|int, mixed>
- Get all the players that sent a request to this user
- getSentRequests() : array<string|int, mixed>
- Get all the players that received a request from this user
- createNewBuddyEntity() : BuddyEntity
- Create a new instance of BuddyEntity
- getUserId() : int
- isBuddy() : bool
- Check if is already a buddy
- isOwnRequest() : bool
- Check if is the request owner
- setUp() : void
- Set up the list of buddies
- setUserId() : mixed
Properties
$_buddies
private
array<string|int, mixed>
$_buddies
= []
$_current_user_id
private
int
$_current_user_id
= 0
Methods
__construct()
Constructor
public
__construct(array<string|int, mixed> $buddies, int $current_user_id) : void
Parameters
- $buddies : array<string|int, mixed>
-
Buddies
- $current_user_id : int
-
Current User ID
Return values
void —getBuddies()
Get all the players that are the current user's buddies
public
getBuddies() : array<string|int, mixed>
Return values
array<string|int, mixed> —getReceivedRequests()
Get all the players that sent a request to this user
public
getReceivedRequests() : array<string|int, mixed>
Return values
array<string|int, mixed> —getSentRequests()
Get all the players that received a request from this user
public
getSentRequests() : array<string|int, mixed>
Return values
array<string|int, mixed> —createNewBuddyEntity()
Create a new instance of BuddyEntity
private
createNewBuddyEntity(array<string|int, mixed> $buddy) : BuddyEntity
Parameters
- $buddy : array<string|int, mixed>
-
Buddy
Return values
BuddyEntity —getUserId()
private
getUserId() : int
Return values
int —isBuddy()
Check if is already a buddy
private
isBuddy(BuddyEntity $buddy) : bool
Parameters
- $buddy : BuddyEntity
-
Buddy
Return values
bool —isOwnRequest()
Check if is the request owner
private
isOwnRequest(BuddyEntity $buddy) : bool
Parameters
- $buddy : BuddyEntity
-
Buddy
Return values
bool —setUp()
Set up the list of buddies
private
setUp(array<string|int, mixed> $buddies) : void
Parameters
- $buddies : array<string|int, mixed>
-
Buddies
Return values
void —setUserId()
private
setUserId(int $user_id) : mixed
Parameters
- $user_id : int
-
User Id