From: Joshua Rüsweg Date: Fri, 13 Apr 2018 19:18:24 +0000 (+0200) Subject: Add helper method to determine reactionType type. X-Git-Tag: 5.2.0_Alpha_1~364^2~101^2~128 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9c8866294c2d073a31a3308a0466c20c7c5964ea;p=GitHub%2FWoltLab%2FWCF.git Add helper method to determine reactionType type. See #2508 --- 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; + } }