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 |
||
23 | class ALNP_OceanWP { |
||
24 | |||
25 | /** |
||
26 | * Initlize Theme. |
||
27 | * |
||
28 | * @access public |
||
29 | * @static |
||
30 | */ |
||
31 | View Code Duplication | public static function init() { |
|
44 | |||
45 | /** |
||
46 | * Filters the location of the repeater template to override the default repeater template. |
||
47 | * |
||
48 | * @access public |
||
49 | * @return string |
||
50 | */ |
||
51 | public static function template_redirect() { |
||
54 | |||
55 | /** |
||
56 | * Filters the template location for get_template_part(). |
||
57 | * |
||
58 | * @access public |
||
59 | * @static |
||
60 | */ |
||
61 | public static function alnp_oceanwp_template_location() { |
||
64 | |||
65 | /** |
||
66 | * Add theme support by providing the theme selectors |
||
67 | * to be applied once the theme is activated. |
||
68 | * |
||
69 | * @access public |
||
70 | * @static |
||
71 | */ |
||
72 | public static function add_theme_support() { |
||
83 | |||
84 | } // END class |
||
85 | |||
87 |