Files
yii2-usuario/lib/User/Service/ResendConfirmationService.php
Antonio Ramirez 3ba01b4674 fix formatting
2016-12-14 02:50:12 +01:00

35 lines
819 B
PHP

<?php
namespace Da\User\Service;
use Da\User\Contracts\ServiceInterface;
use Da\User\Factory\TokenFactory;
use Da\User\Model\User;
use yii\log\Logger;
class ResendConfirmationService implements ServiceInterface
{
protected $model;
protected $mailService;
protected $logger;
public function __construct(User $model, MailService $mailService, Logger $logger)
{
$this->model = $model;
$this->mailService = $mailService;
$this->logger = $logger;
}
public function run()
{
if ($this->model && !$this->model->getIsConfirmed()) {
$token = TokenFactory::makeConfirmationToken($this->model->id);
$this->mailService->setViewParam('token', $token);
return $this->mailService->run();
}
return false;
}
}