Completed
Push — master ( af1fc3...36858c )
by Abdelrahman
06:22
created

PasswordResetNotification   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 58
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A via() 0 4 1
A toMail() 0 12 1
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\Notifications\Notification;
19
use Illuminate\Notifications\Messages\MailMessage;
20
21
class PasswordResetNotification extends Notification
22
{
23
    /**
24
     * The password reset token.
25
     *
26
     * @var string
27
     */
28
    public $token;
29
30
    /**
31
     * The password reset token expiration.
32
     *
33
     * @var string
34
     */
35
    public $expiration;
36
37
    /**
38
     * Create a notification instance.
39
     *
40
     * @param array  $token
41
     * @param string $expiration
42
     */
43
    public function __construct(array $token, $expiration)
44
    {
45
        $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...
46
        $this->expiration = $expiration;
47
    }
48
49
    /**
50
     * Get the notification's channels.
51
     *
52
     * @param mixed $notifiable
53
     *
54
     * @return array|string
55
     */
56
    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...
57
    {
58
        return ['mail'];
59
    }
60
61
    /**
62
     * Build the mail representation of the notification.
63
     *
64
     * @return \Illuminate\Notifications\Messages\MailMessage
65
     */
66
    public function toMail()
67
    {
68
        return (new MailMessage())
69
            ->subject(trans('rinvex/fort::frontend/emails.passwordreset.request.subject'))
0 ignored issues
show
Bug introduced by
It seems like trans('rinvex/fort::fron...reset.request.subject') targeting trans() can also be of type object<Symfony\Component...on\TranslatorInterface>; 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...
70
            ->line(trans('rinvex/fort::frontend/emails.passwordreset.request.intro', ['expire' => $this->expiration]))
0 ignored issues
show
Bug introduced by
It seems like trans('rinvex/fort::fron... => $this->expiration)) targeting trans() can also be of type object<Symfony\Component...on\TranslatorInterface>; however, Illuminate\Notifications...s\SimpleMessage::line() does only seem to accept object<Illuminate\Notifications\Action>|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...
71
            ->action(trans('rinvex/fort::frontend/emails.passwordreset.request.action'), route('rinvex.fort.frontend.passwordreset.reset').'?token='.$this->token['token'].'&email='.$this->token['email'])
0 ignored issues
show
Bug introduced by
It seems like trans('rinvex/fort::fron...dreset.request.action') targeting trans() can also be of type object<Symfony\Component...on\TranslatorInterface>; however, Illuminate\Notifications...SimpleMessage::action() 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...
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 203 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...
72
            ->line(trans('rinvex/fort::frontend/emails.passwordreset.request.outro', [
0 ignored issues
show
Bug introduced by
It seems like trans('rinvex/fort::fron...->token['created_at'])) targeting trans() can also be of type object<Symfony\Component...on\TranslatorInterface>; however, Illuminate\Notifications...s\SimpleMessage::line() does only seem to accept object<Illuminate\Notifications\Action>|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...
73
                'ip'         => $this->token['ip'],
74
                'agent'      => $this->token['agent'],
75
                'created_at' => $this->token['created_at'],
76
            ]));
77
    }
78
}
79