Completed
Pull Request — master (#165)
by Cristian
02:14
created

BackpackUser   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 32.26 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A sendPasswordResetNotification() 0 4 1
A toMail() 10 10 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Backpack\Base\app\Models;
4
5
use App\User;
6
use Backpack\Base\app\Notifications\ResetPasswordNotification as ResetPasswordNotification;
7
8
class BackpackUser extends User
9
{
10
    protected $table = 'users';
11
12
    /**
13
    * Send the password reset notification.
14
    *
15
    * @param  string  $token
16
    * @return void
17
    */
18
    public function sendPasswordResetNotification($token)
19
    {
20
      $this->notify(new ResetPasswordNotification($token));
21
    }
22
23
    /**
24
     * Build the mail representation of the notification.
25
     *
26
     * @return \Illuminate\Notifications\Messages\MailMessage
27
     */
28 View Code Duplication
    public function toMail($notifiable)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
    {
30
        return (new MailMessage())
31
            ->line([
32
                'You are receiving this email because we received a password reset request for your account.',
33
                'Click the button below to reset your password:',
34
            ])
35
            ->action('Reset Password', url(config('backpack.base.route_prefix').'/password/reset', $this->token))
36
            ->line('If you did not request a password reset, no further action is required.');
37
    }
38
}
39