Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 21
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
EchoMenteeClaimPresentationModel
0.00% covered (danger)
0.00%
0 / 21
0.00% covered (danger)
0.00%
0 / 5
56
0.00% covered (danger)
0.00%
0 / 1
 getIconType
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
 getHeaderMessage
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getBodyMessage
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
 getPrimaryLink
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
 getSecondaryLinks
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace GrowthExperiments\Mentorship;
4
5use MediaWiki\Extension\Notifications\Formatters\EchoEventPresentationModel;
6
7class EchoMenteeClaimPresentationModel extends EchoEventPresentationModel {
8
9    /**
10     * @inheritDoc
11     */
12    public function getIconType() {
13        if ( in_array( $this->language->getCode(), [ 'he', 'yi' ] ) ) {
14            // T332732: In he, the mentor icon should be displayed in LTR
15            return 'growthexperiments-mentor-ltr';
16        }
17        return 'growthexperiments-mentor';
18    }
19
20    /**
21     * @inheritDoc
22     */
23    public function getHeaderMessage() {
24        return $this->getMessageWithAgent( 'growthexperiments-notification-header-mentee-claimed' )
25            ->params( $this->event->getTitle()->getText() );
26    }
27
28    /**
29     * @inheritDoc
30     */
31    public function getBodyMessage() {
32        if ( $this->event->getExtra()['reason'] !== '' ) {
33            return $this->msg( 'growthexperiments-notification-body-mentee-claimed' )
34                ->params( $this->event->getExtra()['reason'] );
35        }
36        return false;
37    }
38
39    /**
40     * @inheritDoc
41     */
42    public function getPrimaryLink() {
43        return [
44            'url' => $this->event->getTitle()->getLocalURL(),
45            'label' => $this->event->getTitle()->getText(),
46        ];
47    }
48
49    /**
50     * @inheritDoc
51     */
52    public function getSecondaryLinks() {
53        return [
54            [
55                'url' => 'https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Growth/Tools/How_to_claim_a_mentee',
56                'label' => $this->msg(
57                    'growthexperiments-notification-secondary-link-label-mentee-claimed'
58                )->text()
59            ]
60        ];
61    }
62}