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 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
AbuseFilterRightsLogFormatter
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 3
20
0.00% covered (danger)
0.00%
0 / 1
 getMessageKey
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 extractParameters
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
6
 getMessageParameters
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace MediaWiki\Extension\AbuseFilter\LogFormatter;
4
5use LogFormatter;
6
7class AbuseFilterRightsLogFormatter extends LogFormatter {
8
9    /**
10     * This method is identical to the parent, but it's redeclared to give grep a chance
11     * to find the messages.
12     * @inheritDoc
13     */
14    protected function getMessageKey() {
15        $subtype = $this->entry->getSubtype();
16        // Messages that can be used here:
17        // * logentry-rights-blockautopromote
18        // * logentry-rights-restoreautopromote
19        return "logentry-rights-$subtype";
20    }
21
22    /**
23     * @inheritDoc
24     */
25    protected function extractParameters() {
26        $ret = [];
27        $ret[3] = $this->entry->getTarget()->getText();
28        if ( $this->entry->getSubtype() === 'blockautopromote' ) {
29            $parameters = $this->entry->getParameters();
30            $duration = $parameters['7::duration'];
31            $ret[4] = $this->context->getLanguage()->formatDuration( $duration );
32        }
33        return $ret;
34    }
35
36    /**
37     * @inheritDoc
38     */
39    protected function getMessageParameters() {
40        $params = parent::getMessageParameters();
41        // remove "User:" prefix
42        $params[2] = $this->formatParameterValue( 'user-link', $this->entry->getTarget()->getText() );
43        return $params;
44    }
45
46}