Total Complexity | 5 |
Total Lines | 65 |
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 CheckoutResponse implements PaazlResultInterface |
|
1 ignored issue
–
show
|
|||
18 | { |
||
19 | /** |
||
20 | * @var errorType |
||
21 | */ |
||
22 | protected $error = null; |
||
23 | |||
24 | /** |
||
25 | * @var anyURI |
||
26 | */ |
||
27 | protected $url = null; |
||
28 | |||
29 | /** |
||
30 | * Constructor. |
||
31 | * |
||
32 | * @var errorType |
||
33 | * @var anyURI $url |
||
34 | * |
||
35 | * @param mixed $error |
||
36 | * @param mixed $url |
||
37 | */ |
||
38 | public function __construct($error, $url) |
||
39 | { |
||
40 | $this->error = $error; |
||
41 | $this->url = $url; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @return errorType |
||
46 | */ |
||
47 | public function getError() |
||
48 | { |
||
49 | return $this->error; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @param errorType $error |
||
54 | * |
||
55 | * @return $this |
||
56 | */ |
||
57 | public function setError($error) |
||
58 | { |
||
59 | $this->error = $error; |
||
60 | |||
61 | return $this; |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * @return anyURI |
||
66 | */ |
||
67 | public function getUrl() |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @param anyURI $url |
||
74 | * |
||
75 | * @return $this |
||
76 | */ |
||
77 | public function setUrl($url) |
||
82 | } |
||
83 | } |
||
84 |
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.