UpdateOwnerCommand   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 67
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 8 8 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\Owner;
13
14
use Gitamin\Models\Owner;
15
16 View Code Duplication
final class UpdateOwnerCommand
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 owner instance.
20
     *
21
     * @var \Gitamin\Models\Owner
22
     */
23
    public $owner;
24
25
    /**
26
     * The project owner name.
27
     *
28
     * @var string
29
     */
30
    public $name;
31
32
    /**
33
     * The project owner path.
34
     *
35
     * @var string
36
     */
37
    public $path;
38
39
    /**
40
     * The project owner user_id.
41
     *
42
     * @var int
43
     */
44
    public $user_id;
45
46
    /**
47
     * The project owner description.
48
     *
49
     * @var string
50
     */
51
    public $description;
52
53
    /**
54
     * The validation rules.
55
     *
56
     * @var string[]
57
     */
58
    public $rules = [
59
        'name' => 'string',
60
        'path' => 'string',
61
        'user_id' => 'int',
62
        'description' => 'string',
63
    ];
64
65
    /**
66
     * Create an add project owner command instance.
67
     *
68
     * @param \Gitamin\Models\ProjectNamepsace $owner
69
     * @param string                           $name
70
     * @param string                           $path
71
     * @param int                              $user_id
72
     * @param string                           $description
73
     */
74
    public function __construct($owner, $name, $path, $user_id, $description)
75
    {
76
        $this->owner = $owner;
0 ignored issues
show
Documentation Bug introduced by
It seems like $owner of type object<Gitamin\Models\ProjectNamepsace> is incompatible with the declared type object<Gitamin\Models\Owner> of property $owner.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
77
        $this->name = $name;
78
        $this->path = $path;
79
        $this->user_id = $user_id;
80
        $this->description = $description;
81
    }
82
}
83