Test Failed
Push — master ( ffc71e...1a0a2f )
by Koen
03:32
created

PasswordReset::toMail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 1
dl 0
loc 14
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Notifications\User;
6
7
use App\Models\User;
8
use Illuminate\Notifications\Messages\MailMessage;
0 ignored issues
show
Bug introduced by
The type Illuminate\Notifications\Messages\MailMessage was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Illuminate\Notifications\Notification;
0 ignored issues
show
Bug introduced by
The type Illuminate\Notifications\Notification was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Illuminate\Support\Facades\Lang;
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\Facades\Lang was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use function App\Support\front_url;
12
use function config;
0 ignored issues
show
introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
13
use function http_build_query;
14
15
final class PasswordReset extends Notification
16
{
17
    /**
18
     * The password reset token.
19
     *
20
     * @var string
21
     */
22
    public $token;
23
24
    /**
25
     * Create a notification instance.
26
     *
27
     * @param  string $token
28
     * @return void
29
     */
30
    public function __construct(string $token)
31
    {
32
        $this->token = $token;
33
    }
34
35
    /**
36
     * Get the notification's delivery channels.
37
     *
38
     * @return array
39
     */
40
    public function via(): array
41
    {
42
        return ['mail'];
43
    }
44
45
    /**
46
     * Get the mail representation of the notification.
47
     *
48
     * @param  User $user
49
     * @return \Illuminate\Notifications\Messages\MailMessage
50
     */
51
    public function toMail(User $user): MailMessage
52
    {
53
        $query = http_build_query([
54
            'email' => $user->getEmailForPasswordReset(),
55
        ]);
56
57
        $url = front_url('password/reset/' . $this->token . '?' . $query);
58
59
        return (new MailMessage())
60
            ->subject(Lang::getFromJson('Reset Password Notification'))
61
            ->line(Lang::getFromJson('You are receiving this email because we received a password reset request for your account.'))
62
            ->action(Lang::getFromJson('Reset Password'), $url)
63
            ->line(Lang::getFromJson('This password reset link will expire in :count minutes.', ['count' => config('auth.passwords.user-invitations.expire')]))
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

63
            ->line(Lang::getFromJson('This password reset link will expire in :count minutes.', ['count' => /** @scrutinizer ignore-call */ config('auth.passwords.user-invitations.expire')]))
Loading history...
64
            ->line(Lang::getFromJson('If you did not request a password reset, no further action is required.'));
65
    }
66
}
67