Debian Codegraph @

extensions/OATHAuth/src/Notifications/RecoveryCodeCountPresentationModel.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Extension\OATHAuth\Notifications;
4
5 use MediaWiki\Extension\Notifications\Formatters\EchoEventPresentationModel;
6 use MediaWiki\Extension\OATHAuth\Key\TOTPKey;
7 use MediaWiki\SpecialPage\SpecialPage;
8 use MediaWiki\Title\Title;
9
10 class RecoveryCodeCountPresentationModel extends EchoEventPresentationModel {
11
12 /** @inheritDoc */
13 public function getIconType() {
14 return 'site';
15 }
16
17 /** @inheritDoc */
18 public function getPrimaryLink() {
19 return [
20 'url' => SpecialPage::getTitleFor( 'OATHManage' )->getLocalURL(),
21 'label' => $this->msg( 'oathauth-notifications-recoverycodesleft-primary' )->text()
22 ];
23 }
24
25 /** @inheritDoc */
26 public function getSecondaryLinks() {
27 $link = $this->msg( 'oathauth-notifications-recoverycodesleft-helplink' )->inContentLanguage();
28 $title = Title::newFromText( $link->plain() );
29 if ( !$title ) {
30 // Invalid title, skip
31 return [];
32 }
33 return [ [
34 'url' => $title->getLocalURL(),
35 'label' => $this->msg( 'oathauth-notifications-recoverycodesleft-help' )->text(),
36 'icon' => 'help',
37 ] ];
38 }
39
40 /** @inheritDoc */
41 public function getBodyMessage() {
42 $msg = $this->getMessageWithAgent( 'notification-body-oathauth-recoverycodesleft' );
43 $msg->params( $this->event->getExtraParam( 'codeCount', 0 ) );
44 $msg->params( $this->event->getExtraParam( 'generatedCount', TOTPKey::RECOVERY_CODES_COUNT ) );
45 return $msg;
46 }
47
48 }