Completed
Push — develop ( 10b573...34b970 )
by Abdelrahman
09:38
created

AuthenticationLockoutNotification::toMail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 1
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Fort\Notifications;
6
7
use Illuminate\Http\Request;
8
use Illuminate\Bus\Queueable;
9
use Illuminate\Notifications\Notification;
10
use Illuminate\Contracts\Queue\ShouldQueue;
11
use Illuminate\Notifications\Messages\MailMessage;
12
13
class AuthenticationLockoutNotification extends Notification implements ShouldQueue
14
{
15
    use Queueable;
16
17
    /**
18
     * The request instance.
19
     *
20
     * @var \Illuminate\Http\Request
21
     */
22
    public $request;
23
24
    /**
25
     * Create a notification instance.
26
     *
27
     * @param \Illuminate\Http\Request $request
28
     */
29
    public function __construct(Request $request)
0 ignored issues
show
Bug introduced by
You have injected the Request via parameter $request. This is generally not recommended as there might be multiple instances during a request cycle (f.e. when using sub-requests). Instead, it is recommended to inject the RequestStack and retrieve the current request each time you need it via getCurrentRequest().
Loading history...
30
    {
31
        $this->request = $request;
32
    }
33
34
    /**
35
     * Get the notification's channels.
36
     *
37
     * @param mixed $notifiable
38
     *
39
     * @return array|string
40
     */
41
    public function via($notifiable)
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
42
    {
43
        return ['mail'];
44
    }
45
46
    /**
47
     * Build the mail representation of the notification.
48
     *
49
     * @param mixed $notifiable
50
     *
51
     * @return \Illuminate\Notifications\Messages\MailMessage
52
     */
53
    public function toMail($notifiable): MailMessage
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
54
    {
55
        return (new MailMessage())
56
            ->subject(trans('cortex/fort::emails.auth.lockout.subject'))
57
            ->line(trans('cortex/fort::emails.auth.lockout.intro', [
58
                'created_at' => now(),
59
                'ip' => $this->request->ip(),
60
                'agent' => $this->request->server('HTTP_USER_AGENT'),
61
            ]))
62
            ->line(trans('cortex/fort::emails.auth.lockout.outro'));
63
    }
64
}
65