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 ChargeStrategy 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) |
||
| 50 | |||
| 51 | public function setApplication(Application $app) |
||
| 56 | |||
| 57 | public function setOrder(PurchaseInterface $Order) |
||
| 62 | |||
| 63 | public function getTargetTypes() |
||
| 67 | } |
||
| 68 |