ResetPasswordRequest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 55
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 8 8 1
A authorize() 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 App\Containers\User\UI\API\Requests;
4
5
use App\Ship\Parents\Requests\Request;
6
7
/**
8
 * Class ResetPasswordRequest.
9
 */
10 View Code Duplication
class ResetPasswordRequest extends Request
0 ignored issues
show
Duplication introduced by Spokk
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...
11
{
12
    /**
13
     * Define which Roles and/or Permissions has access to this request.
14
     *
15
     * @var  array
16
     */
17
    protected $access = [
18
        'permissions' => '',
19
        'roles'       => '',
20
    ];
21
22
    /**
23
     * Id's that needs decoding before applying the validation rules.
24
     *
25
     * @var  array
26
     */
27
    protected $decode = [
28
        // 'id',
29
    ];
30
31
    /**
32
     * Defining the URL parameters (e.g, `/user/{id}`) allows applying
33
     * validation rules on them and allows accessing them like request data.
34
     *
35
     * @var  array
36
     */
37
    protected $urlParameters = [
38
         'token',
39
         'email',
40
         'password',
41
    ];
42
43
    /**
44
     * @return  array
45
     */
46
    public function rules()
47
    {
48
        return [
49
            'token' => 'required|max:255',
50
            'email' => 'required|email|max:255',
51
            'password' => 'required|min:6|max:255',
52
        ];
53
    }
54
55
    /**
56
     * @return  bool
57
     */
58
    public function authorize()
59
    {
60
        return $this->check([
61
            'hasAccess',
62
        ]);
63
    }
64
}
65