2018-04-21 12:48:02 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Base object for any unique object
|
|
|
|
*
|
|
|
|
* @author Pierre HUBERT
|
|
|
|
*/
|
|
|
|
|
2018-04-21 13:31:40 +00:00
|
|
|
class BaseUniqueObject {
|
2018-04-21 12:48:02 +00:00
|
|
|
|
|
|
|
//Private fields
|
|
|
|
private $id = 0;
|
|
|
|
|
2018-04-21 18:07:47 +00:00
|
|
|
/**
|
|
|
|
* Public constructor
|
|
|
|
*/
|
|
|
|
public function __construct(){
|
|
|
|
$this->id = 0;
|
|
|
|
}
|
|
|
|
|
2018-04-21 12:48:02 +00:00
|
|
|
//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;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|