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 |
||
9 | class RefundCapturedReservation extends Response |
||
10 | { |
||
11 | use ResultTrait; |
||
12 | use TransactionsTrait; |
||
13 | |||
14 | /** |
||
15 | * @var Money |
||
16 | */ |
||
17 | protected $refundAmount; |
||
18 | |||
19 | /** |
||
20 | * @var int |
||
21 | */ |
||
22 | protected $refundCurrency; |
||
23 | |||
24 | /** |
||
25 | * @deprecated |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $refundResult; |
||
29 | |||
30 | /** |
||
31 | * @return Money |
||
32 | */ |
||
33 | 3 | public function getRefundAmount(): Money |
|
37 | |||
38 | /** |
||
39 | * @return int |
||
40 | */ |
||
41 | 3 | public function getRefundCurrency(): int |
|
45 | |||
46 | /** |
||
47 | * @deprecated |
||
48 | * @return string |
||
49 | */ |
||
50 | 3 | public function getRefundResult(): string |
|
54 | |||
55 | 6 | View Code Duplication | protected function init() |
68 | } |
||
69 |
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.