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 |
||
| 7 | class Jetpack_Sync_Functions { |
||
| 8 | |||
| 9 | public static function get_modules() { |
||
| 13 | |||
| 14 | public static function get_taxonomies() { |
||
| 19 | |||
| 20 | public static function get_post_types() { |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Finds out if a site is using a version control system. |
||
| 28 | * @return string ( '1' | '0' ) |
||
| 29 | **/ |
||
| 30 | View Code Duplication | public static function is_version_controlled() { |
|
| 44 | |||
| 45 | /** |
||
| 46 | * Returns true if the site has file write access false otherwise. |
||
| 47 | * @return string ( '1' | '0' ) |
||
| 48 | **/ |
||
| 49 | View Code Duplication | public static function file_system_write_access() { |
|
| 70 | |||
| 71 | public static function wp_version() { |
||
| 75 | } |