CreateProblemRequest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 51
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 3 3 1
A rules() 16 16 1
A messages() 16 16 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\Itil\Requests;
4
5
use App\Http\Requests\Request;
6
7 View Code Duplication
class CreateProblemRequest extends Request {
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...
8
9
    /**
10
     * Determine if the user is authorized to make this request.
11
     *
12
     * @return bool
13
     */
14
    public function authorize() {
15
        return true;
16
    }
17
18
    /**
19
     * Get the validation rules that apply to the request.
20
     *
21
     * @return array
22
     */
23
    public function rules() {
24
        return [
25
26
            'from' => 'required|email',           
27
            'description' => 'required',
28
            'department' => 'required',
29
            'status_type_id' => 'required',
30
            'subject'=>'required',
31
//            'priority_id' => 'required',
0 ignored issues
show
Unused Code Comprehensibility introduced by
52% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
32
//            'impact_id' => 'required',
33
//            'location_type_id' => 'required',
34
//            'group_id' => 'required',
35
//            'agent_id' => 'required',
36
//            'assigned_id' => 'required',
37
                ];
38
    }
39
40
    public function messages() {
41
        return [
42
43
            "from.required" => "From Required",
44
            
45
            "description.required" => "Description Required",
46
            "department.required" => "Department Required",
47
            "status_type_id.required" => "Status Type Required",
48
            "priority_id.required" => "Priority Required",
49
            "impact_id.required" => "impact Required",
50
            "location_type_id.required" => "Location Type required",
51
            "group_id.required" => "Group Required",
52
            "agent_id.required" => "Agent Required",
53
            "assigned_id.required" => "Assigned Required",
54
        ];
55
    }
56
57
}
58