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 |
||
| 13 | class mysql_index extends \phpbb\db\migration\migration |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * Do not run this migration if the DB is not MySQL |
||
| 17 | * |
||
| 18 | * @return bool |
||
| 19 | */ |
||
| 20 | public function effectively_installed() |
||
| 24 | |||
| 25 | public static function depends_on() |
||
| 33 | |||
| 34 | View Code Duplication | public function update_data() |
|
| 43 | |||
| 44 | /** |
||
| 45 | * Add a MYSQLI FULLTEXT index to phpbb_topics.topic_title (if needed). |
||
| 46 | * |
||
| 47 | * This is a retry of the similar action in release_1_1_0_data. |
||
| 48 | * The first attempt would miss older InnoDB tables that do not support |
||
| 49 | * FULLTEXT. If that happened, then this will convert the table to |
||
| 50 | * MyISAM so we can then create the fulltext index. The old storage |
||
| 51 | * engine will be stored so it can be reverted on uninstall. |
||
| 52 | * Data is reverted in the release_1_3_0_fulltext migration. |
||
| 53 | */ |
||
| 54 | public function add_topic_title_fulltext() |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Get an instance of the similartopics mysqli driver |
||
| 70 | * |
||
| 71 | * @return \vse\similartopics\driver\mysqli |
||
| 72 | */ |
||
| 73 | protected function get_driver() |
||
| 77 | } |
||
| 78 |