Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 12
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 / 12
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 / 12
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace MediaWiki\Extension\AbuseFilter\Hooks\Handlers;
4
5use EchoAttributeManager;
6use EchoUserLocator;
7use MediaWiki\Extension\AbuseFilter\EchoNotifier;
8use MediaWiki\Extension\AbuseFilter\ThrottleFilterPresentationModel;
9use MediaWiki\Extension\Notifications\Hooks\BeforeCreateEchoEventHook;
10
11class EchoHandler implements BeforeCreateEchoEventHook {
12
13    /**
14     * @param array &$notifications
15     * @param array &$notificationCategories
16     * @param array &$icons
17     */
18    public function onBeforeCreateEchoEvent(
19        array &$notifications,
20        array &$notificationCategories,
21        array &$icons
22    ) {
23        $notifications[ EchoNotifier::EVENT_TYPE ] = [
24            'category' => 'system',
25            'section' => 'alert',
26            'group' => 'negative',
27            'presentation-model' => ThrottleFilterPresentationModel::class,
28            EchoAttributeManager::ATTR_LOCATORS => [
29                [
30                    [ EchoUserLocator::class, 'locateFromEventExtra' ],
31                    [ 'user' ]
32                ]
33            ],
34        ];
35    }
36
37}