Completed
Push — master ( 857394...4794c5 )
by Mahmoud
03:25
created

ConfirmUserEmailRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 7 7 1
A all() 8 8 1
A authorize() 4 4 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\Email\UI\API\Requests;
4
5
use App\Port\Request\Abstracts\Request;
6
7
/**
8
 * Class ConfirmUserEmailRequest.
9
 *
10
 * @author Mahmoud Zalt <[email protected]>
11
 */
12 View Code Duplication
class ConfirmUserEmailRequest 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...
13
{
14
15
    /**
16
     * Get the validation rules that apply to the request.
17
     *
18
     * @return array
19
     */
20
    public function rules()
21
    {
22
        return [
23
            'id'   => 'required|integer', // url parameter
24
            'code' => 'required|min:35|max:45', // url parameter
25
        ];
26
    }
27
28
    /**
29
     * Override the all() to automatically apply validation rules to the URL parameters
30
     *
31
     * @return  array
32
     */
33
    public function all()
34
    {
35
        $data = parent::all();
36
        $data['id'] = $this->route('id');
37
        $data['code'] = $this->route('code');
38
39
        return $data;
40
    }
41
42
    /**
43
     * Determine if the user is authorized to make this request.
44
     *
45
     * @return bool
46
     */
47
    public function authorize()
48
    {
49
        return true;
50
    }
51
}
52