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 |
||
27 | class disable_bbcodes extends container_aware_migration |
||
28 | { |
||
29 | /** @var \phpbb\config\db_text */ |
||
30 | protected $configText; |
||
31 | |||
32 | /** |
||
33 | * {@inheritDoc} |
||
34 | */ |
||
35 | public function effectively_installed() |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | public function update_data() |
||
50 | |||
51 | /** |
||
52 | * {@inheritdoc} |
||
53 | */ |
||
54 | public function revert_data() |
||
60 | |||
61 | /** |
||
62 | * Get ABBC3 BBCodes that were disabled from a previous extension purge, |
||
63 | * and re-display them on post. |
||
64 | */ |
||
65 | public function display_bbcodes_on() |
||
76 | |||
77 | /** |
||
78 | * Set ABBC3 BBCodes Display on Post to 0 so they will no longer |
||
79 | * appear in posting buttons when extension is purged. |
||
80 | */ |
||
81 | public function display_bbcodes_off() |
||
101 | |||
102 | /** |
||
103 | * Update the display on posting state for custom BBCodes |
||
104 | * |
||
105 | * @param array $bbcodes |
||
106 | * @param bool $display |
||
107 | */ |
||
108 | View Code Duplication | protected function update_displayed_bbcodes(array $bbcodes, $display) |
|
118 | |||
119 | /** |
||
120 | * Get the config text object |
||
121 | * |
||
122 | * @return \phpbb\config\db_text |
||
123 | */ |
||
124 | protected function getConfigText() |
||
133 | } |
||
134 |