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