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

PasswordUpdate   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 8
dl 0
loc 30
ccs 0
cts 12
cp 0
rs 10
c 1
b 0
f 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A message() 0 5 1
A toMail() 0 7 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