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 |
||
6 | class RefundCapturedReservation extends Response |
||
7 | { |
||
8 | /** |
||
9 | * @var float |
||
10 | */ |
||
11 | protected $refundAmount; |
||
12 | |||
13 | /** |
||
14 | * @var int |
||
15 | */ |
||
16 | protected $refundCurrency; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $result; |
||
22 | |||
23 | /** |
||
24 | * @deprecated |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $refundResult; |
||
28 | |||
29 | /** |
||
30 | * @var Transaction[] |
||
31 | */ |
||
32 | protected $transactions; |
||
33 | |||
34 | /** |
||
35 | * @return float |
||
36 | */ |
||
37 | public function getRefundAmount(): float |
||
41 | |||
42 | /** |
||
43 | * @param float $refundAmount |
||
44 | * @return RefundCapturedReservation |
||
45 | */ |
||
46 | public function setRefundAmount(float $refundAmount) : self |
||
51 | |||
52 | /** |
||
53 | * @return int |
||
54 | */ |
||
55 | public function getRefundCurrency(): int |
||
59 | |||
60 | /** |
||
61 | * @param int $refundCurrency |
||
62 | * @return RefundCapturedReservation |
||
63 | */ |
||
64 | public function setRefundCurrency(int $refundCurrency) : self |
||
69 | |||
70 | /** |
||
71 | * @return string |
||
72 | */ |
||
73 | public function getResult(): string |
||
77 | |||
78 | /** |
||
79 | * @param string $result |
||
80 | * @return RefundCapturedReservation |
||
81 | */ |
||
82 | public function setResult(string $result) : self |
||
87 | |||
88 | /** |
||
89 | * @deprecated |
||
90 | * @return string |
||
91 | */ |
||
92 | public function getRefundResult(): string |
||
96 | |||
97 | /** |
||
98 | * @deprecated |
||
99 | * @param string $refundResult |
||
100 | * @return RefundCapturedReservation |
||
101 | */ |
||
102 | public function setRefundResult(string $refundResult) : self |
||
107 | |||
108 | /** |
||
109 | * @return Transaction[] |
||
110 | */ |
||
111 | public function getTransactions(): array |
||
115 | |||
116 | /** |
||
117 | * @param Transaction[] $transactions |
||
118 | * @return RefundCapturedReservation |
||
119 | */ |
||
120 | public function setTransactions(array $transactions) : self |
||
125 | |||
126 | /** |
||
127 | * @param Transaction $transaction |
||
128 | * @return RefundCapturedReservation |
||
129 | */ |
||
130 | public function addTransaction(Transaction $transaction) : self |
||
135 | |||
136 | View Code Duplication | protected function init() |
|
152 | } |
||
153 |
This property has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.