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 |
||
15 | class ShippingStrategy implements CalculateStrategyInterface |
||
|
|||
16 | { |
||
17 | /* @var Application $app */ |
||
18 | protected $app; |
||
19 | |||
20 | /* @var Order $Order */ |
||
21 | protected $Order; |
||
22 | |||
23 | /** @var OrderItemTypeRepository */ |
||
24 | protected $OrderItemTypeRepository; |
||
25 | |||
26 | public function execute(ShipmentItemCollection $ShipmentItems) |
||
54 | |||
55 | public function setApplication(Application $app) |
||
60 | |||
61 | public function setOrder(PurchaseInterface $Order) |
||
66 | |||
67 | public function getTargetTypes() |
||
71 | } |
||
72 |