mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-12-25 13:08:58 +00:00
Created friend model
This commit is contained in:
parent
e09b280e20
commit
375a4c6c82
47
classes/models/Friend.php
Normal file
47
classes/models/Friend.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Friend model
|
||||||
|
*
|
||||||
|
* @author Pierre HUBER
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Friend {
|
||||||
|
|
||||||
|
//Private fields
|
||||||
|
private $friendID;
|
||||||
|
private $accepted;
|
||||||
|
private $following;
|
||||||
|
private $last_activity_time;
|
||||||
|
|
||||||
|
//Set and get friend ID
|
||||||
|
public function setFriendID(int $id){
|
||||||
|
$this->friendID = $id;
|
||||||
|
}
|
||||||
|
public function getFriendID() : int {
|
||||||
|
return $this->friendID;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Set and get the accepted state of the friendship
|
||||||
|
public function setAccepted(bool $accepted){
|
||||||
|
$this->accepted = $accepted;
|
||||||
|
}
|
||||||
|
public function isAccepted() : bool {
|
||||||
|
return $this->accepted;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Set and get the following state of the friendship
|
||||||
|
public function setFollowing(bool $following){
|
||||||
|
$this->following = $following;
|
||||||
|
}
|
||||||
|
public function isFollowing() : bool {
|
||||||
|
return $this->following;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Set and get the last activity time of the friend
|
||||||
|
public function setLastActivityTime(int $time){
|
||||||
|
$this->last_activity_time = $time;
|
||||||
|
}
|
||||||
|
public function getLastActivityTime() : int {
|
||||||
|
return $this->last_activity_time;
|
||||||
|
}
|
||||||
|
}
|
5
init.php
5
init.php
@ -51,6 +51,11 @@ $tokens = new Tokens();
|
|||||||
$cs->register("tokens", $tokens);
|
$cs->register("tokens", $tokens);
|
||||||
unset($tokens);
|
unset($tokens);
|
||||||
|
|
||||||
|
//Include models
|
||||||
|
foreach(glob(PROJECT_PATH."classes/models/*.php") as $classFile){
|
||||||
|
require_once $classFile;
|
||||||
|
}
|
||||||
|
|
||||||
//Include components
|
//Include components
|
||||||
foreach(glob(PROJECT_PATH."classes/components/*.php") as $classFile){
|
foreach(glob(PROJECT_PATH."classes/components/*.php") as $classFile){
|
||||||
require_once $classFile;
|
require_once $classFile;
|
||||||
|
Loading…
Reference in New Issue
Block a user