accounts/common/emails/templates/ConfirmNewEmail.php

52 lines
1.1 KiB
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace common\emails\templates;
use common\emails\Template;
use yii\base\InvalidCallException;
class ConfirmNewEmail extends Template {
/**
* @var string|null
*/
private $username;
/**
* @var string|null
*/
private $key;
public function setUsername(string $username): void {
$this->username = $username;
}
public function setKey(string $key): void {
$this->key = $key;
}
public function getSubject(): string {
return 'Ely.by Account new E-mail confirmation';
}
2018-04-18 02:17:25 +05:30
public function getParams(): array {
if ($this->username === null || $this->key === null) {
throw new InvalidCallException('You need to set username and key params first');
}
2018-04-18 02:17:25 +05:30
return [
'username' => $this->username,
'key' => $this->key,
2018-04-18 02:17:25 +05:30
];
}
protected function getView() {
return [
'html' => '@common/emails/views/new-email-confirmation-html',
'text' => '@common/emails/views/new-email-confirmation-text',
];
}
}