Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
EchoHandler
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 onBeforeCreateEchoEvent
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace MediaWiki\Extension\OATHAuth\Hook;
4
5use MediaWiki\Extension\Notifications\Hooks\BeforeCreateEchoEventHook;
6use MediaWiki\Extension\OATHAuth\Notifications\DisablePresentationModel;
7use MediaWiki\Extension\OATHAuth\Notifications\EnablePresentationModel;
8
9/**
10 * Hooks from Echo extension,
11 * which is optional to use with this extension.
12 */
13class EchoHandler implements BeforeCreateEchoEventHook {
14
15    /**
16     * Hook: BeforeCreateEchoEvent
17     *
18     * Configure our notification types. We don't register a category since
19     * these are all "system" messages that cannot be disabled.
20     *
21     * @param array &$notifications
22     * @param array &$notificationCategories
23     * @param array &$notificationIcons
24     */
25    public function onBeforeCreateEchoEvent(
26        array &$notifications, array &$notificationCategories, array &$notificationIcons
27    ) {
28        $notifications['oathauth-disable'] = [
29            'category' => 'system',
30            'group' => 'negative',
31            'section' => 'alert',
32            'presentation-model' => DisablePresentationModel::class,
33            'canNotifyAgent' => true,
34            'user-locators' => [ 'EchoUserLocator::locateEventAgent' ],
35        ];
36
37        $notifications['oathauth-enable'] = [
38            'category' => 'system',
39            'group' => 'positive',
40            'section' => 'alert',
41            'presentation-model' => EnablePresentationModel::class,
42            'canNotifyAgent' => true,
43            'user-locators' => [ 'EchoUserLocator::locateEventAgent' ],
44        ];
45    }
46}