Failed Conditions
Pull Request — master (#263)
by Maximo
02:38
created

UpdateEmail::message()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Canvas\Notifications;
6
7
use Canvas\Contracts\Notifications\NotificationInterfase;
8
use Baka\Mail\Message;
9
use Phalcon\Di;
10
use Canvas\Template;
11
12
class UpdateEmail extends Notification implements NotificationInterfase
13
{
14
    //protected $useQueue = true;
15
16
    /**
17
     * Notification msg.
18
     *
19
     * @return string
20
     */
21
    public function message(): string
22
    {
23
        //$emailChangeUrl = $this->config->app->frontEndUrl . '/user/' . $user->user_activation_email . '/email';
24
        //$subject = _('Email Change Request');
25
        //$body = sprintf(_('Click %shere%s to set a new email for your account.'), '<a href="' . $emailChangeUrl . '">', '</a>');
26
        //break;
27
28
        return Template::generate('update-email', $this->entity->toArray());
29
    }
30
31
    /**
32
     * Email body.
33
     *
34
     * @return Message|null
35
     */
36
    public function toMail(): ?Message
37
    {
38
        $app = Di::getDefault()->getApp();
39
40
        return $this->mail->to($this->entity->getEmail())
41
            ->subject('Confirm email update in ' . $app->name)
42
            ->content($this->message());
43
    }
44
}
45