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 |
||
16 | View Code Duplication | class PaymentEditPage extends AbstractAdminPageStyleGuide |
|
|
|||
17 | { |
||
18 | public static $登録完了メッセージ = '.c-container .c-contentsArea div.alert-success'; |
||
19 | |||
20 | public function __construct(\AcceptanceTester $I) |
||
24 | |||
25 | public static function at($I) |
||
31 | |||
32 | public function 入力_支払方法($value) |
||
38 | |||
39 | public function 入力_手数料($value) |
||
45 | |||
46 | public function 入力_利用条件下限($value) |
||
52 | |||
53 | public function 登録() |
||
57 | } |
||
58 |
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.