mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-23 22:09:29 +00:00
31 lines
469 B
PHP
31 lines
469 B
PHP
<?php
|
|
/**
|
|
* Base object for any unique object
|
|
*
|
|
* @author Pierre HUBERT
|
|
*/
|
|
|
|
class BaseUniqueObject {
|
|
|
|
//Private fields
|
|
private $id = 0;
|
|
|
|
//Set and get object ID
|
|
public function set_id(int $id){
|
|
$this->id = $id;
|
|
}
|
|
|
|
public function get_id() : int {
|
|
return $this->id;
|
|
}
|
|
|
|
/**
|
|
* Check wether this object is valid or not
|
|
*
|
|
* @return bool TRUE if this object is valid / FALSE else
|
|
*/
|
|
public function isValid() : bool {
|
|
return $this->id > 0;
|
|
}
|
|
|
|
} |