Total Complexity | 7 |
Total Lines | 78 |
Duplicated Lines | 100 % |
Changes | 0 |
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 |
||
11 | View Code Duplication | class User implements CommandDataInterface |
|
|
|||
12 | { |
||
13 | /** |
||
14 | * @Id |
||
15 | * @GeneratedValue |
||
16 | * @Column(type="integer") |
||
17 | */ |
||
18 | private $id; |
||
19 | |||
20 | /** |
||
21 | * @Column(type="string", nullable=true) |
||
22 | */ |
||
23 | private $lineUserId; |
||
24 | |||
25 | /** |
||
26 | * @Column(type="string", nullable=true) |
||
27 | */ |
||
28 | private $lineActiveCmd; |
||
29 | |||
30 | /** |
||
31 | * @Column(type="array", nullable=true) |
||
32 | */ |
||
33 | private $lineCommandData; |
||
34 | |||
35 | /** |
||
36 | * @return int |
||
37 | */ |
||
38 | public function getId() |
||
39 | { |
||
40 | return $this->id; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | public function getLineUserId() |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * {@inheritdoc} |
||
53 | */ |
||
54 | public function setLineUserId($lineUserId) |
||
55 | { |
||
56 | $this->lineUserId = $lineUserId; |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * {@inheritdoc} |
||
61 | */ |
||
62 | public function getLineActiveCmd() |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * {@inheritdoc} |
||
69 | */ |
||
70 | public function setLineActiveCmd($lineActiveCmd) |
||
71 | { |
||
72 | $this->lineActiveCmd = $lineActiveCmd; |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * {@inheritdoc} |
||
77 | */ |
||
78 | public function getLineCommandData() |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * {@inheritdoc} |
||
85 | */ |
||
86 | public function setLineCommandData(array $lineCommandData) |
||
89 | } |
||
90 | } |
||
91 |
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.