Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
EchoEditThresholdPresentationModel
0.00% covered (danger)
0.00%
0 / 15
0.00% covered (danger)
0.00%
0 / 3
30
0.00% covered (danger)
0.00%
0 / 1
 getIconType
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getHeaderMessageKey
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getPrimaryLink
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2
3namespace MediaWiki\Extension\Notifications\Formatters;
4
5class EchoEditThresholdPresentationModel extends EchoEventPresentationModel {
6
7    public function getIconType() {
8        return 'edit';
9    }
10
11    public function getHeaderMessageKey() {
12        // The following messages are used here:
13        // * notification-header-thank-you-1-edit
14        // * notification-header-thank-you-10-edit
15        // * notification-header-thank-you-100-edit
16        // * notification-header-thank-you-1000-edit
17        // * notification-header-thank-you-10000-edit
18        // * notification-header-thank-you-100000-edit
19        // * notification-header-thank-you-1000000-edit
20        // * notification-header-thank-you-10000000-edit
21        return 'notification-header-thank-you-' . $this->event->getExtraParam( 'editCount' ) . '-edit';
22    }
23
24    public function getPrimaryLink() {
25        if ( !$this->event->getTitle() ) {
26            return false;
27        }
28
29        if ( $this->event->getExtraParam( 'revid' ) ) {
30            $params = [
31                'oldid' => 'prev',
32                'diff' => $this->event->getExtraParam( 'revid' )
33            ];
34        } else {
35            $params = [];
36        }
37        $url = $this->event->getTitle()->getLocalURL( $params );
38
39        return [
40            'url' => $url,
41            'label' => $this->msg( 'notification-link-thank-you-edit', $this->getViewingUserForGender() )->text()
42        ];
43    }
44}