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_Make { |
|
| 23 | |||
| 24 | /** |
||
| 25 | * Initlize Theme. |
||
| 26 | * |
||
| 27 | * @access public |
||
| 28 | * @static |
||
| 29 | */ |
||
| 30 | public static function init() { |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Filters the location of the repeater template. |
||
| 40 | * |
||
| 41 | * @access public |
||
| 42 | * @static |
||
| 43 | * @return string |
||
| 44 | */ |
||
| 45 | public static function alnp_make_template_redirect() { |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Add theme support by providing the theme selectors |
||
| 51 | * to be applied once the theme is activated. |
||
| 52 | * |
||
| 53 | * @access public |
||
| 54 | * @static |
||
| 55 | */ |
||
| 56 | public static function add_theme_support() { |
||
| 66 | |||
| 67 | } // END class |
||
| 68 | |||
| 70 |