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 |
||
15 | class WC_WCCOM_Site_Installer_Requirements_Check { |
||
16 | /** |
||
17 | * Check if the site met the requirements |
||
18 | * |
||
19 | * @version 3.8.0 |
||
20 | * @return bool|WP_Error Does the site met the requirements? |
||
21 | */ |
||
22 | public static function met_requirements() { |
||
40 | |||
41 | /** |
||
42 | * Validates if WP CRON is enabled. |
||
43 | * |
||
44 | * @since 3.8.0 |
||
45 | * @return bool |
||
46 | */ |
||
47 | private static function met_wp_cron_requirement() { |
||
50 | |||
51 | /** |
||
52 | * Validates if `WP_CONTENT_DIR` is writable. |
||
53 | * |
||
54 | * @since 3.8.0 |
||
55 | * @return bool |
||
56 | */ |
||
57 | private static function met_filesystem_requirement() { |
||
60 | } |
||
61 |