From 04f815792c7c46907d617d2b8526a7947b695f2e Mon Sep 17 00:00:00 2001 From: Pierre Date: Sun, 18 Feb 2018 15:47:59 +0100 Subject: [PATCH] Added new check methods. --- classes/models/Notification.php | 38 ++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/classes/models/Notification.php b/classes/models/Notification.php index 77fdcc0..7eb1e15 100644 --- a/classes/models/Notification.php +++ b/classes/models/Notification.php @@ -27,7 +27,7 @@ class Notification { /** * Event type */ - const COMMENT_CREATED = "comments"; + const COMMENT_CREATED = "comment_created"; const ELEM_CREATED = "elem_created"; const ELEM_UPDATED = "elem_updated"; @@ -110,6 +110,15 @@ class Notification { 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 * @@ -129,6 +138,15 @@ class Notification { 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 * @@ -147,6 +165,15 @@ class Notification { 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 * @@ -228,6 +255,15 @@ class Notification { 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 *