Added new check methods.

This commit is contained in:
Pierre 2018-02-18 15:47:59 +01:00
parent bf6d15652f
commit 04f815792c

View File

@ -27,7 +27,7 @@ class Notification {
/** /**
* Event type * Event type
*/ */
const COMMENT_CREATED = "comments"; const COMMENT_CREATED = "comment_created";
const ELEM_CREATED = "elem_created"; const ELEM_CREATED = "elem_created";
const ELEM_UPDATED = "elem_updated"; const ELEM_UPDATED = "elem_updated";
@ -110,6 +110,15 @@ class Notification {
return $this->time_create; return $this->time_create;
} }
/**
* Check if the notification has a specified creation time
*
* @return bool TRUE if the creation time was specified
*/
public function has_time_create() : bool {
return $this->time_create != null;
}
/** /**
* Set the seen state of the notification * Set the seen state of the notification
* *
@ -129,6 +138,15 @@ class Notification {
return $this->seen; return $this->seen;
} }
/**
* Check if the seen state of the notification has been set or not
*
* @return bool TRUE if the seen state of the notification is set / FALSE else
*/
public function has_seen_state() : bool {
return $this->seen != null;
}
/** /**
* Set notification source user id * Set notification source user id
* *
@ -147,6 +165,15 @@ class Notification {
return $this->from_user_id; return $this->from_user_id;
} }
/**
* Check if the notification has a given user source
*
* @return bool TRUE if the source of the notification has been specified / FALSE else
*/
public function has_from_user_id() : bool {
return $this->from_user_id != null;
}
/** /**
* Set notification destination user id * Set notification destination user id
* *
@ -228,6 +255,15 @@ class Notification {
return $this->type; return $this->type;
} }
/**
* Check if the notification has a given creation time
*
* @return bool TRUE if the notification has a type / FALSE else
*/
public function has_type() : bool {
return $this->type != null;
}
/** /**
* Set notification event visibility * Set notification event visibility
* *