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 |
||
| 22 | View Code Duplication | class ALNP_Twenty_Sixteen { |
|
| 23 | |||
| 24 | /** |
||
| 25 | * Initlize Theme. |
||
| 26 | * |
||
| 27 | * @access public |
||
| 28 | * @static |
||
| 29 | */ |
||
| 30 | public static function init() { |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Add theme support by providing the theme selectors |
||
| 37 | * to be applied once the theme is activated. |
||
| 38 | * |
||
| 39 | * @access public |
||
| 40 | * @static |
||
| 41 | */ |
||
| 42 | public static function add_theme_support() { |
||
| 52 | |||
| 53 | } // END class |
||
| 54 | |||
| 56 |