Debian Codegraph @

extensions/Echo/includes/Hooks/HookRunner.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Extension\Notifications\Hooks;
4
5 use MediaWiki\Extension\Notifications\Model\Event;
6 use MediaWiki\Extension\Notifications\Model\Notification;
7 use MediaWiki\HookContainer\HookContainer;
8 use MediaWiki\Revision\RevisionRecord;
9 use MediaWiki\Title\Title;
10 use MediaWiki\User\User;
11 use MediaWiki\User\UserIdentity;
12
13 /**
14 * This is a hook runner class, see docs/Hooks.md in core.
15 * @internal
16 */
17 class HookRunner implements
18 BeforeCreateEchoEventHook,
19 BeforeDisplayOrangeAlertHook,
20 BeforeEchoEventInsertHook,
21 EchoAbortEmailNotificationHook,
22 EchoCanAbortNewMessagesAlertHook,
23 EchoCreateNotificationCompleteHook,
24 EchoGetBundleRulesHook,
25 EchoGetDefaultNotifiedUsersHook,
26 EchoGetEventsForRevisionHook,
27 EchoGetNotificationTypesHook,
28 EventInsertCompleteHook
29 {
30 private HookContainer $hookContainer;
31
32 public function __construct( HookContainer $hookContainer ) {
33 $this->hookContainer = $hookContainer;
34 }
35
36 /**
37 * @inheritDoc
38 */
39 public function onBeforeCreateEchoEvent(
40 array &$notifications,
41 array &$notificationCategories,
42 array &$notificationIcons
43 ) {
44 return $this->hookContainer->run(
45 'BeforeCreateEchoEvent',
46 [ &$notifications, &$notificationCategories, &$notificationIcons ]
47 );
48 }
49
50 /**
51 * @inheritDoc
52 */
53 public function onBeforeDisplayOrangeAlert( User $user, Title $title ) {
54 return $this->hookContainer->run(
55 'BeforeDisplayOrangeAlert',
56 [ $user, $title ]
57 );
58 }
59
60 /**
61 * @inheritDoc
62 */
63 public function onBeforeEchoEventInsert( Event $event ) {
64 return $this->hookContainer->run(
65 'BeforeEchoEventInsert',
66 [ $event ]
67 );
68 }
69
70 /**
71 * @inheritDoc
72 */
73 public function onEchoAbortEmailNotification( UserIdentity $user, Event $event ) {
74 return $this->hookContainer->run(
75 'EchoAbortEmailNotification',
76 [ $user, $event ]
77 );
78 }
79
80 /**
81 * @inheritDoc
82 */
83 public function onEchoCanAbortNewMessagesAlert() {
84 return $this->hookContainer->run(
85 'EchoCanAbortNewMessagesAlert'
86 );
87 }
88
89 /**
90 * @inheritDoc
91 */
92 public function onEchoCreateNotificationComplete( Notification $notification ) {
93 return $this->hookContainer->run(
94 'EchoCreateNotificationComplete',
95 [ $notification ]
96 );
97 }
98
99 /**
100 * @inheritDoc
101 */
102 public function onEchoGetBundleRules( Event $event, string &$bundleKey ) {
103 return $this->hookContainer->run(
104 'EchoGetBundleRules',
105 [ $event, &$bundleKey ]
106 );
107 }
108
109 /**
110 * @inheritDoc
111 */
112 public function onEchoGetDefaultNotifiedUsers( Event $event, array &$users ) {
113 return $this->hookContainer->run(
114 'EchoGetDefaultNotifiedUsers',
115 [ $event, &$users ]
116 );
117 }
118
119 /**
120 * @inheritDoc
121 */
122 public function onEchoGetEventsForRevision( array &$events, RevisionRecord $revision, bool $isRevert ) {
123 return $this->hookContainer->run(
124 'EchoGetEventsForRevision',
125 [ &$events, $revision, $isRevert ]
126 );
127 }
128
129 /**
130 * @inheritDoc
131 */
132 public function onEchoGetNotificationTypes( User $user, Event $event, array &$userNotifyTypes ) {
133 return $this->hookContainer->run(
134 'EchoGetNotificationTypes',
135 [ $user, $event, &$userNotifyTypes ]
136 );
137 }
138
139 /**
140 * @inheritDoc
141 */
142 public function onEventInsertComplete( Event $event ) {
143 return $this->hookContainer->run(
144 'EventInsertComplete',
145 [ $event ]
146 );
147 }
148 }