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 |
||
27 | class PluginManagePage extends AbstractAdminPageStyleGuide |
||
28 | { |
||
29 | const 完了メーッセージ = '#page_admin_store_plugin > div.c-container > div.c-contentsArea > div.alert.alert-success.alert-dismissible.fade.show.m-3 > span'; |
||
30 | |||
31 | public function __construct(\AcceptanceTester $I) |
||
35 | |||
36 | public static function at($I) |
||
42 | |||
43 | /** |
||
44 | * @param $pluginCode |
||
45 | * @return PluginManagePage |
||
46 | */ |
||
47 | public function ストアプラグイン_有効化($pluginCode) { |
||
50 | |||
51 | /** |
||
52 | * @param $pluginCode |
||
53 | * @return PluginManagePage |
||
54 | */ |
||
55 | public function ストアプラグイン_無効化($pluginCode) { |
||
58 | |||
59 | /** |
||
60 | * @param $pluginCode |
||
61 | * @return PluginManagePage |
||
62 | * @throws \Exception |
||
63 | */ |
||
64 | View Code Duplication | public function ストアプラグイン_削除($pluginCode) { |
|
72 | |||
73 | private function ストアプラグイン_ボタンクリック($pluginCode, $label) |
||
79 | } |
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.