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 | class ALNP_Twenty_Twelve { |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Initlize Theme. |
||
| 26 | * |
||
| 27 | * @access public |
||
| 28 | * @static |
||
| 29 | */ |
||
| 30 | View Code Duplication | public static function init() { |
|
| 40 | |||
| 41 | /** |
||
| 42 | * Adds a compaitable post navigation. |
||
| 43 | * |
||
| 44 | * @access public |
||
| 45 | * @static |
||
| 46 | */ |
||
| 47 | public static function alnp_twentytwelve_post_navigation() { |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Add theme support by providing the theme selectors |
||
| 58 | * to be applied once the theme is activated. |
||
| 59 | * |
||
| 60 | * @access public |
||
| 61 | * @static |
||
| 62 | */ |
||
| 63 | public static function add_theme_support() { |
||
| 73 | |||
| 74 | } // END class |
||
| 75 | |||
| 77 |