7a56a4b45f9d4ff6ab41e17370d6ed1184525a03
[GitHub/WoltLab/WCF.git] /
1 <?php
2
3 namespace wcf\system\user\notification\event;
4
5 use wcf\system\cache\runtime\CommentRuntimeCache;
6 use wcf\system\user\notification\object\CommentResponseUserNotificationObject;
7
8 /**
9 * Provides a default implementation for user notifications about comment responses.
10 *
11 * @author Marcel Werk
12 * @copyright 2001-2023 WoltLab GmbH
13 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
14 * @since 6.0
15 *
16 * @method CommentResponseUserNotificationObject getUserNotificationObject()
17 */
18 abstract class AbstractCommentResponseUserNotificationEvent extends AbstractSharedUserNotificationEvent
19 {
20 /**
21 * @inheritDoc
22 */
23 protected $stackable = true;
24
25 /**
26 * @inheritDoc
27 */
28 public function getTitle(): string
29 {
30 $count = \count($this->getAuthors());
31 if ($count > 1) {
32 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.response.title.stacked', [
33 'count' => $count,
34 'timesTriggered' => $this->notification->timesTriggered,
35 'typeName' => $this->getTypeName(),
36 ]);
37 }
38
39 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.response.title', [
40 'typeName' => $this->getTypeName(),
41 ]);
42 }
43
44 /**
45 * @inheritDoc
46 */
47 public function getEmailTitle()
48 {
49 $count = \count($this->getAuthors());
50 if ($count > 1) {
51 return $this->getTitle();
52 }
53
54 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.response.mail.title', [
55 'objectTitle' => $this->getObjectTitle(),
56 'typeName' => $this->getTypeName(),
57 ]);
58 }
59
60 /**
61 * @inheritDoc
62 */
63 public function getEventHash()
64 {
65 return \sha1($this->eventID . '-' . $this->getUserNotificationObject()->commentID);
66 }
67
68 /**
69 * Returns the name of the type to which the comment belong.
70 */
71 protected abstract function getTypeName(): string;
72
73 /**
74 * Returns the title of the object to which the comment belong.
75 */
76 protected abstract function getObjectTitle(): string;
77 }