Completed
Push — master ( 953ae8...6664e0 )
by Cristian
05:42
created

ResetPasswordNotification   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A toMail() 0 10 1
1
<?php
2
3
namespace Backpack\Base\app\Notifications;
4
5
use Illuminate\Auth\Notifications\ResetPassword as ResetPassword;
6
use Illuminate\Notifications\Messages\MailMessage;
7
use Illuminate\Notifications\Notification;
8
9
class ResetPasswordNotification extends ResetPassword
10
{
11
    /**
12
     * Build the mail representation of the notification.
13
     *
14
     * @return \Illuminate\Notifications\Messages\MailMessage
15
     */
16
    public function toMail()
17
    {
18
        return (new MailMessage())
19
            ->line([
0 ignored issues
show
Documentation introduced by
array('You are receiving... reset your password:') is of type array<integer,string,{"0":"string","1":"string"}>, but the function expects a object<Illuminate\Notifications\Action>|string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
20
                'You are receiving this email because we received a password reset request for your account.',
21
                'Click the button below to reset your password:',
22
            ])
23
            ->action('Reset Password', url(config('backpack.base.route_prefix').'/password/reset', $this->token))
0 ignored issues
show
Bug introduced by
It seems like url(config('backpack.bas...d/reset', $this->token) targeting url() can also be of type object<Illuminate\Contracts\Routing\UrlGenerator>; 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...
24
            ->line('If you did not request a password reset, no further action is required.');
25
    }
26
}
27