@@ -31,41 +31,41 @@ |
||
| 31 | 31 | |
| 32 | 32 | class Notifier implements INotifier { |
| 33 | 33 | |
| 34 | - /** @var IFactory */ |
|
| 35 | - private $factory; |
|
| 34 | + /** @var IFactory */ |
|
| 35 | + private $factory; |
|
| 36 | 36 | |
| 37 | - /** @var IURLGenerator */ |
|
| 38 | - private $url; |
|
| 37 | + /** @var IURLGenerator */ |
|
| 38 | + private $url; |
|
| 39 | 39 | |
| 40 | - public function __construct(IFactory $factory, IURLGenerator $url) { |
|
| 41 | - $this->factory = $factory; |
|
| 42 | - $this->url = $url; |
|
| 43 | - } |
|
| 40 | + public function __construct(IFactory $factory, IURLGenerator $url) { |
|
| 41 | + $this->factory = $factory; |
|
| 42 | + $this->url = $url; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - public function prepare(INotification $notification, $languageCode) { |
|
| 46 | - if ($notification->getApp() !== 'twofactor_backupcodes') { |
|
| 47 | - // Not my app => throw |
|
| 48 | - throw new \InvalidArgumentException(); |
|
| 49 | - } |
|
| 45 | + public function prepare(INotification $notification, $languageCode) { |
|
| 46 | + if ($notification->getApp() !== 'twofactor_backupcodes') { |
|
| 47 | + // Not my app => throw |
|
| 48 | + throw new \InvalidArgumentException(); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - // Read the language from the notification |
|
| 52 | - $l = $this->factory->get('twofactor_backupcodes', $languageCode); |
|
| 51 | + // Read the language from the notification |
|
| 52 | + $l = $this->factory->get('twofactor_backupcodes', $languageCode); |
|
| 53 | 53 | |
| 54 | - switch ($notification->getSubject()) { |
|
| 55 | - case 'create_backupcodes': |
|
| 56 | - $notification->setParsedSubject( |
|
| 57 | - $l->t('Generate backup codes') |
|
| 58 | - )->setParsedMessage( |
|
| 59 | - $l->t('You have enabled two-factor authentication but have not yet generated backup codes. Be sure to do this in case you lose access to your second factor.') |
|
| 60 | - ); |
|
| 54 | + switch ($notification->getSubject()) { |
|
| 55 | + case 'create_backupcodes': |
|
| 56 | + $notification->setParsedSubject( |
|
| 57 | + $l->t('Generate backup codes') |
|
| 58 | + )->setParsedMessage( |
|
| 59 | + $l->t('You have enabled two-factor authentication but have not yet generated backup codes. Be sure to do this in case you lose access to your second factor.') |
|
| 60 | + ); |
|
| 61 | 61 | |
| 62 | - $notification->setLink($this->url->linkToRouteAbsolute('settings.PersonalSettings.index', ['section' => 'security'])); |
|
| 63 | - return $notification; |
|
| 62 | + $notification->setLink($this->url->linkToRouteAbsolute('settings.PersonalSettings.index', ['section' => 'security'])); |
|
| 63 | + return $notification; |
|
| 64 | 64 | |
| 65 | - default: |
|
| 66 | - // Unknown subject => Unknown notification => throw |
|
| 67 | - throw new \InvalidArgumentException(); |
|
| 68 | - } |
|
| 69 | - } |
|
| 65 | + default: |
|
| 66 | + // Unknown subject => Unknown notification => throw |
|
| 67 | + throw new \InvalidArgumentException(); |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | } |