ViewDashboardRequest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 54
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

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