mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-27 07:49:27 +00:00
Can check the validity of the User object
This commit is contained in:
parent
06bd098d2f
commit
86c1cf12c5
@ -16,6 +16,15 @@ class User {
|
||||
private $virtualDirectory;
|
||||
private $accountImageURL;
|
||||
|
||||
/**
|
||||
* Public constructor of this object
|
||||
*/
|
||||
public function __construct(){
|
||||
|
||||
//Set the user ID to 0 by default (invalid user)
|
||||
$this->set_id(0);
|
||||
|
||||
}
|
||||
|
||||
//Set and get user ID
|
||||
private function set_id(int $id){
|
||||
@ -83,4 +92,13 @@ class User {
|
||||
private function get_accountImageURL() : string {
|
||||
return $this->accountImageURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check wether is object is valid or not
|
||||
*
|
||||
* @return bool TRUE if this object is valid / FALSE else
|
||||
*/
|
||||
public function isValid() : bool {
|
||||
return $this->id > 0;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user