Completed
Pull Request — master (#87)
by Cristian
08:06
created

ForgotPasswordController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A guard() 4 4 1
A showLinkRequestForm() 6 6 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\Http\Controllers\Auth;
4
5
use Backpack\Base\app\Http\Controllers\Controller;
6
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
7
8 View Code Duplication
class ForgotPasswordController extends Controller
0 ignored issues
show
Duplication introduced by
This class 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...
9
{
10
    protected $data = []; // the information we send to the view
11
12
    /*
13
    |--------------------------------------------------------------------------
14
    | Password Reset Controller
15
    |--------------------------------------------------------------------------
16
    |
17
    | This controller is responsible for handling password reset emails and
18
    | includes a trait which assists in sending these notifications from
19
    | your application to your users. Feel free to explore this trait.
20
    |
21
    */
22
23
    use SendsPasswordResetEmails;
24
25
    /**
26
     * Create a new controller instance.
27
     *
28
     * @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...
29
     */
30
    public function __construct()
31
    {
32
        $this->middleware(backpack_middleware('guest'));
33
    }
34
35
    public function guard()
36
    {
37
        return \Auth::guard(backpack_guard());
38
    }
39
40
    // -------------------------------------------------------
41
    // Laravel overwrites for loading backpack views
42
    // -------------------------------------------------------
43
44
    /**
45
     * Display the form to request a password reset link.
46
     *
47
     * @return \Illuminate\Http\Response
48
     */
49
    public function showLinkRequestForm()
50
    {
51
        $this->data['title'] = trans('backpack::base.reset_password'); // set the page title
52
53
        return view('backpack::auth.passwords.email', $this->data);
54
    }
55
}
56