accounts/common/emails/templates/RegistrationEmail.php

41 lines
923 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace common\emails\templates;
use common\emails\TemplateWithRenderer;
use yii\base\InvalidCallException;
class RegistrationEmail extends TemplateWithRenderer {
/**
* @var RegistrationEmailParams|null
*/
private $params;
public function getSubject(): string {
return 'Ely.by Account registration';
}
public function getTemplateName(): string {
return 'register';
}
public function setParams(RegistrationEmailParams $params): void {
$this->params = $params;
}
public function getParams(): array {
if ($this->params === null) {
throw new InvalidCallException('You need to set params first');
}
return [
'username' => $this->params->getUsername(),
'code' => $this->params->getCode(),
'link' => $this->params->getLink(),
];
}
}