Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 18 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| TwoFactorAuthWarningPresentationModel | |
0.00% |
0 / 18 |
|
0.00% |
0 / 5 |
42 | |
0.00% |
0 / 1 |
| getIconType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getPrimaryLink | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| getSecondaryLinks | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| getHeaderMessage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getBodyMessage | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\WikimediaMessages\Notifications; |
| 4 | |
| 5 | use MediaWiki\Extension\Notifications\Formatters\EchoEventPresentationModel; |
| 6 | use MediaWiki\SpecialPage\SpecialPage; |
| 7 | |
| 8 | class TwoFactorAuthWarningPresentationModel extends EchoEventPresentationModel { |
| 9 | |
| 10 | /** @inheritDoc */ |
| 11 | public function getIconType() { |
| 12 | return 'key-warning'; |
| 13 | } |
| 14 | |
| 15 | /** @inheritDoc */ |
| 16 | public function getPrimaryLink() { |
| 17 | return [ |
| 18 | 'url' => SpecialPage::getTitleFor( 'OATHManage' )->getLocalURL(), |
| 19 | 'label' => $this->msg( 'wikimedia-2fa-notification-action' )->text() |
| 20 | ]; |
| 21 | } |
| 22 | |
| 23 | /** @inheritDoc */ |
| 24 | public function getSecondaryLinks() { |
| 25 | $links = []; |
| 26 | |
| 27 | $links[] = [ |
| 28 | // @phpcs:ignore Generic.Files.LineLength.TooLong |
| 29 | 'url' => 'https://meta.wikimedia.org/wiki/Special:MyLanguage/Mandatory_two-factor_authentication_for_users_with_some_extended_rights', |
| 30 | 'label' => $this->msg( 'wikimedia-2fa-notification-info' )->text(), |
| 31 | 'icon' => 'info', |
| 32 | ]; |
| 33 | return $links; |
| 34 | } |
| 35 | |
| 36 | /** @inheritDoc */ |
| 37 | public function getHeaderMessage() { |
| 38 | return $this->msg( 'wikimedia-2fa-notification-header' ); |
| 39 | } |
| 40 | |
| 41 | /** @inheritDoc */ |
| 42 | public function getBodyMessage() { |
| 43 | $date = $this->event->getExtraParam( 'deadline' ); |
| 44 | if ( !$date ) { |
| 45 | return false; |
| 46 | } |
| 47 | return $this->msg( 'wikimedia-2fa-notification-body' ) |
| 48 | ->dateParams( $date ); |
| 49 | } |
| 50 | |
| 51 | } |