Test Failed
Pull Request — master (#166)
by Maximo
05:27
created

PasswordUpdate::toMail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
ccs 0
cts 6
cp 0
crap 2
rs 10
c 1
b 0
f 1
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
11
class PasswordUpdate extends Notification implements NotificationInterfase
12
{
13
    protected $type = Notification::APPS;
14
    //protected $useQueue = true;
15
16
    /**
17
     * Notification msg.
18
     *
19
     * @return string
20
     */
21
    public function message(): string
22
    {
23
        $app = Di::getDefault()->getApp();
24
25
        return "Hi {$this->fromUser->firstname} {$this->fromUser->lastname}, your password for {$app->name} was updated <br /><br />
26
                Thanks ";
27
    }
28
29
    /**
30
     * Email body.
31
     *
32
     * @return Message|null
33
     */
34
    public function toMail(): ?Message
35
    {
36
        $app = Di::getDefault()->getApp();
37
38
        return $this->mail->to($this->fromUser->getEmail())
39
            ->subject($app->name . ' - Password Updated')
40
            ->content($this->message());
41
    }
42
}
43