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 |
||
| 21 | View Code Duplication | class ModEntry extends \Risoluto\RisolutoControllerBase implements \Risoluto\RisolutoControllerInterface |
|
| 22 | { |
||
| 23 | // View関連の処理を使用する |
||
| 24 | use \Risoluto\RisolutoViewTrait; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * play() |
||
| 28 | * |
||
| 29 | * 主処理を行う |
||
| 30 | * |
||
| 31 | * @access public |
||
| 32 | * |
||
| 33 | * @param void |
||
| 34 | * |
||
| 35 | * @return void なし |
||
| 36 | * @throws \Exception フォームデータを取得できなかった場合はThrow |
||
| 37 | */ |
||
| 38 | public function play() |
||
| 72 | } |