Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
TranslationNotificationsLogFormatter | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
getMessageParameters | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
12 |
1 | <?php |
2 | /** |
3 | * Class for formatting TranslationNotifications logs. |
4 | * |
5 | * @file |
6 | * @author Sucheta Ghoshal |
7 | * @copyright Copyright © 2013, Sucheta Ghoshal |
8 | * @license GPL-2.0-or-later |
9 | */ |
10 | |
11 | namespace MediaWiki\Extension\TranslationNotifications; |
12 | |
13 | use LogFormatter; |
14 | use MediaWiki\Extension\TranslationNotifications\Utilities\NotificationMessageBuilder; |
15 | |
16 | /** |
17 | * Class for formatting TranslationNotifications logs. |
18 | */ |
19 | class TranslationNotificationsLogFormatter extends LogFormatter { |
20 | public function getMessageParameters(): array { |
21 | $params = parent::getMessageParameters(); |
22 | |
23 | // $params[3] is $languagesForLog, |
24 | // $params[4] is $deadlineDate, |
25 | // $params[5] is $priority |
26 | // $params[9] is $languageCount |
27 | // If no specific languages are defined, set languageForLog to 'all languages'. |
28 | if ( $params[3] === '' ) { |
29 | $params[3] = $this->msg( 'translationnotifications-log-alllanguages' )->text(); |
30 | // Set language count to arbitrary high number for 'all languages'. |
31 | $params[9] = 999; |
32 | } else { |
33 | // If specific languages are defined, show them. |
34 | $params[9] = count( explode( ',', $params[3] ) ); |
35 | } |
36 | |
37 | if ( $params[4] === '' ) { |
38 | // If deadline is not set, deadlineDate is set to 'none'. |
39 | $params[4] = $this->msg( 'translationnotifications-nodeadline' )->text(); |
40 | } |
41 | // possible messages here: |
42 | // 'translationnotifications-priority-high' |
43 | // 'translationnotifications-priority-low' |
44 | // 'translationnotifications-priority-medium' |
45 | // 'translationnotifications-priority-unset' |
46 | $params[5] = NotificationMessageBuilder::getPriorityMessage( $params[5] ) |
47 | ->setContext( $this->context ) |
48 | ->text(); |
49 | |
50 | return $params; |
51 | } |
52 | } |