5eb5360a5c4fa9b758f6619a6e043e1adc3fbd81
[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 * @method CommentUserNotificationObject getUserNotificationObject()
14 */
15 abstract class AbstractCommentUserNotificationEvent extends AbstractSharedUserNotificationEvent
16 {
17 /**
18 * @inheritDoc
19 */
20 protected $stackable = true;
21
22 /**
23 * @inheritDoc
24 */
25 public function getTitle(): string
26 {
27 $count = \count($this->getAuthors());
28 if ($count > 1) {
29 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.title.stacked', [
30 'count' => $count,
31 'timesTriggered' => $this->notification->timesTriggered,
32 'typeName' => $this->getTypeName(),
33 ]);
34 }
35
36 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.title', [
37 'typeName' => $this->getTypeName(),
38 ]);
39 }
40
41 /**
42 * @inheritDoc
43 */
44 public function getEmailTitle()
45 {
46 $count = \count($this->getAuthors());
47 if ($count > 1) {
48 return $this->getTitle();
49 }
50
51 return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.mail.title', [
52 'objectTitle' => $this->getObjectTitle(),
53 'typeName' => $this->getTypeName(),
54 ]);
55 }
56
57 /**
58 * Returns the name of the type to which the comment belong.
59 */
60 protected abstract function getTypeName(): string;
61
62 /**
63 * Returns the title of the object to which the comment belong.
64 */
65 protected abstract function getObjectTitle(): string;
66 }