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 |
||
| 3 | class EmailCallback extends SocialIntegrationControllerBaseClass implements SocialIntegrationAPIInterface |
||
| 4 | { |
||
| 5 | |||
| 6 | |||
| 7 | /** |
||
| 8 | * make sure to return TRUE as response if the message is sent |
||
| 9 | * successfully |
||
| 10 | * Sends a message from the current user to someone else in the networkd |
||
| 11 | * @param Int | String | Member $to - |
||
| 12 | * @param String $message - Message you are sending |
||
| 13 | * @param String $link - Link to send with message - NOT USED IN EMAIL |
||
| 14 | * @param Array - other variables that we include |
||
| 15 | * @return Boolean - return TRUE as success |
||
| 16 | */ |
||
| 17 | public static function send_message($to, $message, $link = "", $otherVariables = array()) |
||
| 63 | |||
| 64 | public static function get_list_of_friends($limit = 12, $searchString = "") |
||
| 68 | |||
| 69 | /** |
||
| 70 | * |
||
| 71 | * return Object | Null |
||
| 72 | */ |
||
| 73 | public static function get_current_user() |
||
| 77 | |||
| 78 | public static function is_valid_user($id) |
||
| 82 | |||
| 83 | /** |
||
| 84 | * Link to login form |
||
| 85 | * @param String $returnURL |
||
| 86 | * @return String |
||
| 87 | */ |
||
| 88 | public static function connect_url($returnURL = "", $existingMember = false) |
||
| 103 | |||
| 104 | public function meondatabase() |
||
| 108 | } |
||
| 109 |