Can check the validity of the User object

This commit is contained in:
Pierre 2018-04-15 12:36:59 +02:00
parent 06bd098d2f
commit 86c1cf12c5

View File

@ -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;
}
}