Completed
Push — master ( 453b67...10e484 )
by Abdelrahman
11:57
created

PasswordResetRequestNotification::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
rs 9.4285
c 1
b 0
f 0
1
<?php
2
3
/*
4
 * NOTICE OF LICENSE
5
 *
6
 * Part of the Rinvex Fort Package.
7
 *
8
 * This source file is subject to The MIT License (MIT)
9
 * that is bundled with this package in the LICENSE file.
10
 *
11
 * Package: Rinvex Fort Package
12
 * License: The MIT License (MIT)
13
 * Link:    https://rinvex.com
14
 */
15
16
namespace Rinvex\Fort\Notifications;
17
18
use Illuminate\Support\Facades\Lang;
19
use Illuminate\Notifications\Notification;
20
use Illuminate\Notifications\Messages\MailMessage;
21
22
class PasswordResetRequestNotification extends Notification
23
{
24
    /**
25
     * The password reset token.
26
     *
27
     * @var string
28
     */
29
    public $token;
30
31
    /**
32
     * The password reset token expiration.
33
     *
34
     * @var string
35
     */
36
    public $expiration;
37
38
    /**
39
     * Create a notification instance.
40
     *
41
     * @param array  $token
42
     * @param string $expiration
43
     *
44
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
45
     */
46
    public function __construct(array $token, $expiration)
47
    {
48
        $this->token      = $token;
0 ignored issues
show
Documentation Bug introduced by
It seems like $token of type array is incompatible with the declared type string of property $token.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
49
        $this->expiration = $expiration;
50
    }
51
52
    /**
53
     * Get the notification's channels.
54
     *
55
     * @param mixed $notifiable
56
     *
57
     * @return array|string
58
     */
59
    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...
60
    {
61
        return ['mail'];
62
    }
63
64
    /**
65
     * Build the mail representation of the notification.
66
     *
67
     * @return \Illuminate\Notifications\Messages\MailMessage
68
     */
69
    public function toMail()
70
    {
71
        return (new MailMessage)
72
            ->subject(Lang::get('rinvex.fort::email.reset.request.subject'))
73
            ->line(Lang::get('rinvex.fort::email.reset.request.intro'))
74
            ->action(Lang::get('rinvex.fort::email.reset.request.action'), route('rinvex.fort.password.reset').'?token='.$this->token['token'].'&email='.$this->token['email'])
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 175 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
75
            ->line(Lang::get('rinvex.fort::email.reset.request.outro', [
76
                'created_at' => $this->token['created_at'],
77
                'ip'         => $this->token['ip'],
78
                'agent'      => $this->token['agent'],
79
            ]));
80
    }
81
}
82