From 9c8866294c2d073a31a3308a0466c20c7c5964ea Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Fri, 13 Apr 2018 21:18:24 +0200 Subject: [PATCH] Add helper method to determine reactionType type. See #2508 --- .../data/reaction/type/ReactionType.class.php | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/data/reaction/type/ReactionType.class.php b/wcfsetup/install/files/lib/data/reaction/type/ReactionType.class.php index e4f96ffaaf..d95cbc0737 100644 --- a/wcfsetup/install/files/lib/data/reaction/type/ReactionType.class.php +++ b/wcfsetup/install/files/lib/data/reaction/type/ReactionType.class.php @@ -69,7 +69,7 @@ class ReactionType extends DatabaseObject { /** * Renders the reaction icon. * - * @return string + * @return string */ public function renderIcon(): string { switch ($this->iconType) { @@ -100,4 +100,31 @@ class ReactionType extends DatabaseObject { break; } } + + /** + * Returns true, if reaction is a positive reaction. + * + * @return bool + */ + public function isPositive() { + return $this->type == self::REACTION_TYPE_POSITIVE; + } + + /** + * Returns true, if reaction is a negative reaction. + * + * @return bool + */ + public function isNegative() { + return $this->type == self::REACTION_TYPE_NEGATIVE; + } + + /** + * Returns true, if reaction is a neutral reaction. + * + * @return bool + */ + public function isNeutral() { + return $this->type == self::REACTION_TYPE_NEUTRAL; + } } -- 2.20.1