2017-04-21 04:11:43 +05:30
|
|
|
<?php
|
2019-06-07 04:46:13 +05:30
|
|
|
declare(strict_types=1);
|
|
|
|
|
2017-04-24 21:52:24 +05:30
|
|
|
namespace common\emails\templates;
|
2017-04-21 04:11:43 +05:30
|
|
|
|
2017-04-24 21:52:24 +05:30
|
|
|
use common\emails\TemplateWithRenderer;
|
2019-06-17 02:29:19 +05:30
|
|
|
use yii\base\InvalidCallException;
|
2017-04-21 04:11:43 +05:30
|
|
|
|
|
|
|
class RegistrationEmail extends TemplateWithRenderer {
|
|
|
|
|
|
|
|
/**
|
2019-06-17 02:29:19 +05:30
|
|
|
* @var RegistrationEmailParams|null
|
2017-04-21 04:11:43 +05:30
|
|
|
*/
|
2019-06-17 02:29:19 +05:30
|
|
|
private $params;
|
2017-04-21 04:11:43 +05:30
|
|
|
|
|
|
|
public function getSubject(): string {
|
|
|
|
return 'Ely.by Account registration';
|
|
|
|
}
|
|
|
|
|
2017-04-25 04:39:59 +05:30
|
|
|
public function getTemplateName(): string {
|
2017-04-21 04:11:43 +05:30
|
|
|
return 'register';
|
|
|
|
}
|
|
|
|
|
2019-06-17 02:29:19 +05:30
|
|
|
public function setParams(RegistrationEmailParams $params): void {
|
|
|
|
$this->params = $params;
|
|
|
|
}
|
|
|
|
|
2017-04-21 04:11:43 +05:30
|
|
|
public function getParams(): array {
|
2019-06-17 02:29:19 +05:30
|
|
|
if ($this->params === null) {
|
|
|
|
throw new InvalidCallException('You need to set params first');
|
|
|
|
}
|
|
|
|
|
2017-04-21 04:11:43 +05:30
|
|
|
return [
|
|
|
|
'username' => $this->params->getUsername(),
|
|
|
|
'code' => $this->params->getCode(),
|
|
|
|
'link' => $this->params->getLink(),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|