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 MediaWiki\Extension\AbuseFilter\EchoNotifier;
6use MediaWiki\Extension\AbuseFilter\ThrottleFilterPresentationModel;
7use MediaWiki\Extension\Notifications\AttributeManager;
8use MediaWiki\Extension\Notifications\Hooks\BeforeCreateEchoEventHook;
9use MediaWiki\Extension\Notifications\UserLocator;
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            AttributeManager::ATTR_LOCATORS => [
29                [
30                    [ UserLocator::class, 'locateFromEventExtra' ],
31                    [ 'user' ]
32                ]
33            ],
34        ];
35    }
36
37}