Completed
Pull Request — master (#47)
by Şəhriyar
10:29
created

ResetPasswordNotification::getPasswordResetEmailSubject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace App\Notifications;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Notifications\Notification;
7
use Illuminate\Contracts\Queue\ShouldQueue;
8
use Illuminate\Notifications\Messages\MailMessage;
9
10
class ResetPasswordNotification extends Notification
11
{
12
    use Queueable;
13
14
    /**
15
     * Password reset token
16
     *
17
     * @var string
18
     */
19
    public $token;
20
21
    /**
22
     * Create a new notification instance.
23
     *
24
     * @param string $token
25
     */
26
    public function __construct($token)
27
    {
28
        $this->token = $token;
29
    }
30
31
    /**
32
     * Get the notification's delivery channels.
33
     *
34
     * @return array
35
     */
36
    public function via()
37
    {
38
        return ['mail'];
39
    }
40
41
    /**
42
     * Get the mail representation of the notification.
43
     *
44
     * @return \Illuminate\Notifications\Messages\MailMessage
45
     */
46
    public function toMail()
47
    {
48
        return (new MailMessage)
49
            ->subject($this->getPasswordResetEmailSubject())
0 ignored issues
show
Bug introduced by
It seems like $this->getPasswordResetEmailSubject() targeting App\Notifications\ResetP...wordResetEmailSubject() can also be of type object<Illuminate\Contra...Translation\Translator>; however, Illuminate\Notifications...impleMessage::subject() does only seem to accept string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
50
            ->view('auth/emails/password', ['token' => $this->token]);
51
    }
52
53
    /**
54
     * Get the e-mail subject line to be used for the reset link email.
55
     *
56
     * @return string
57
     */
58
    private function getPasswordResetEmailSubject()
59
    {
60
        return trans('passwords.reset_email_subject');
61
    }
62
}
63