Total Complexity | 7 |
Total Lines | 93 |
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 |
||
17 | View Code Duplication | class GetExistingImageLabelsResponse implements PaazlResultInterface |
|
|
|||
18 | { |
||
19 | /** |
||
20 | * @var errorType |
||
21 | */ |
||
22 | protected $error = null; |
||
23 | |||
24 | /** |
||
25 | * @var labelType |
||
26 | */ |
||
27 | protected $label = null; |
||
28 | |||
29 | /** |
||
30 | * @var labelMetaDataType |
||
31 | */ |
||
32 | protected $metaData = null; |
||
33 | |||
34 | /** |
||
35 | * Constructor. |
||
36 | * |
||
37 | * @var errorType |
||
38 | * @var labelType $label |
||
39 | * @var labelMetaDataType $metaData |
||
40 | * |
||
41 | * @param mixed $error |
||
42 | * @param mixed $label |
||
43 | * @param mixed $metaData |
||
44 | */ |
||
45 | public function __construct($error, $label, $metaData) |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @return errorType |
||
54 | */ |
||
55 | public function getError() |
||
56 | { |
||
57 | return $this->error; |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @param errorType $error |
||
62 | * |
||
63 | * @return $this |
||
64 | */ |
||
65 | public function setError($error) |
||
66 | { |
||
67 | $this->error = $error; |
||
68 | |||
69 | return $this; |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @return labelType |
||
74 | */ |
||
75 | public function getLabel() |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * @param labelType $label |
||
82 | * |
||
83 | * @return $this |
||
84 | */ |
||
85 | public function setLabel($label) |
||
86 | { |
||
87 | $this->label = $label; |
||
88 | |||
89 | return $this; |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * @return labelMetaDataType |
||
94 | */ |
||
95 | public function getMetaData() |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * @param labelMetaDataType $metaData |
||
102 | * |
||
103 | * @return $this |
||
104 | */ |
||
105 | public function setMetaData($metaData) |
||
110 | } |
||
111 | } |
||
112 |
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.