UpdateProjectCommand   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 87
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 4
Bugs 0 Features 2
Metric Value
wmc 1
c 4
b 0
f 2
lcom 0
cbo 0
dl 87
loc 87
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 10 10 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
/*
4
 * This file is part of Gitamin.
5
 *
6
 * Copyright (C) 2015-2016 The Gitamin Team
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Gitamin\Commands\Project;
13
14
use Gitamin\Models\Project;
15
16 View Code Duplication
final class UpdateProjectCommand
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...
17
{
18
    /**
19
     * The project to update.
20
     *
21
     * @var \Gitamin\Models\Project
22
     */
23
    public $project;
24
25
    /**
26
     * The project name.
27
     *
28
     * @var string
29
     */
30
    public $name;
31
32
    /**
33
     * The project description.
34
     *
35
     * @var string
36
     */
37
    public $description;
38
39
    /**
40
     * The project visibility_level.
41
     *
42
     * @var int
43
     */
44
    public $visibility_level;
45
46
    /**
47
     * The project path.
48
     *
49
     * @var string
50
     */
51
    public $path;
52
53
    /**
54
     * The project creator id.
55
     *
56
     * @var int
57
     */
58
    public $creator_id;
59
60
    /**
61
     * The project owner.
62
     *
63
     * @var int
64
     */
65
    public $owner_id;
66
67
    /**
68
     * The validation rules.
69
     *
70
     * @var string[]
71
     */
72
    public $rules = [
73
        'name' => 'string',
74
        'description' => 'string',
75
        'visibility_level' => 'int|min:1|max:4',
76
        'path' => 'string',
77
        'creator_id' => 'int',
78
        'owner_id' => 'int',
79
    ];
80
81
    /**
82
     * Create a new update project command instance.
83
     *
84
     * @param \Gitamin\Models\Project $project
85
     * @param string                  $name
86
     * @param string                  $description
87
     * @param int                     $visibility_level
88
     * @param string                  $path
89
     * @param int                     $creator_id
90
     * @param int                     $owner_id
91
     */
92
    public function __construct(Project $project, $name, $description, $visibility_level, $path, $creator_id, $owner_id)
93
    {
94
        $this->project = $project;
95
        $this->name = $name;
96
        $this->description = $description;
97
        $this->visibility_level = (int) $visibility_level;
98
        $this->path = $path;
99
        $this->creator_id = $creator_id;
100
        $this->owner_id = $owner_id;
101
    }
102
}
103