| Conditions | 3 |
| Paths | 3 |
| Total Lines | 173 |
| Code Lines | 161 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 125 | public function codeSettings() |
||
| 126 | { |
||
| 127 | // @todo this list looks broken (I don't remember any enablePinnedTopics in SMF 1.1) |
||
| 128 | $do_import = array( |
||
| 129 | 'news', |
||
| 130 | 'compactTopicPagesContiguous', |
||
| 131 | 'compactTopicPagesEnable', |
||
| 132 | 'enablePinnedTopics', |
||
| 133 | 'todayMod', |
||
| 134 | 'enablePreviousNext', |
||
| 135 | 'pollMode', |
||
| 136 | 'enableVBStyleLogin', |
||
| 137 | 'enableCompressedOutput', |
||
| 138 | 'attachmentSizeLimit', |
||
| 139 | 'attachmentPostLimit', |
||
| 140 | 'attachmentNumPerPostLimit', |
||
| 141 | 'attachmentDirSizeLimit', |
||
| 142 | 'attachmentExtensions', |
||
| 143 | 'attachmentCheckExtensions', |
||
| 144 | 'attachmentShowImages', |
||
| 145 | 'attachmentEnable', |
||
| 146 | 'attachmentEncryptFilenames', |
||
| 147 | 'attachmentThumbnails', |
||
| 148 | 'attachmentThumbWidth', |
||
| 149 | 'attachmentThumbHeight', |
||
| 150 | 'censorIgnoreCase', |
||
| 151 | 'mostOnline', |
||
| 152 | 'mostOnlineToday', |
||
| 153 | 'mostDate', |
||
| 154 | 'allow_disableAnnounce', |
||
| 155 | 'trackStats', |
||
| 156 | 'userLanguage', |
||
| 157 | 'titlesEnable', |
||
| 158 | 'topicSummaryPosts', |
||
| 159 | 'enableErrorLogging', |
||
| 160 | 'max_image_width', |
||
| 161 | 'max_image_height', |
||
| 162 | 'onlineEnable', |
||
| 163 | 'smtp_host', |
||
| 164 | 'smtp_port', |
||
| 165 | 'smtp_username', |
||
| 166 | 'smtp_password', |
||
| 167 | 'mail_type', |
||
| 168 | 'timeLoadPageEnable', |
||
| 169 | 'totalMembers', |
||
| 170 | 'totalTopics', |
||
| 171 | 'totalMessages', |
||
| 172 | 'simpleSearch', |
||
| 173 | 'censor_vulgar', |
||
| 174 | 'censor_proper', |
||
| 175 | 'enablePostHTML', |
||
| 176 | 'enableEmbeddedFlash', |
||
| 177 | 'xmlnews_enable', |
||
| 178 | 'xmlnews_maxlen', |
||
| 179 | 'hotTopicPosts', |
||
| 180 | 'hotTopicVeryPosts', |
||
| 181 | 'registration_method', |
||
| 182 | 'send_validation_onChange', |
||
| 183 | 'send_welcomeEmail', |
||
| 184 | 'allow_editDisplayName', |
||
| 185 | 'allow_hideOnline', |
||
| 186 | 'guest_hideContacts', |
||
| 187 | 'spamWaitTime', |
||
| 188 | 'pm_spam_settings', |
||
| 189 | 'reserveWord', |
||
| 190 | 'reserveCase', |
||
| 191 | 'reserveUser', |
||
| 192 | 'reserveName', |
||
| 193 | 'reserveNames', |
||
| 194 | 'autoLinkUrls', |
||
| 195 | 'banLastUpdated', |
||
| 196 | 'avatar_max_height_external', |
||
| 197 | 'avatar_max_width_external', |
||
| 198 | 'avatar_action_too_large', |
||
| 199 | 'avatar_max_height_upload', |
||
| 200 | 'avatar_max_width_upload', |
||
| 201 | 'avatar_resize_upload', |
||
| 202 | 'avatar_download_png', |
||
| 203 | 'failed_login_threshold', |
||
| 204 | 'oldTopicDays', |
||
| 205 | 'edit_wait_time', |
||
| 206 | 'edit_disable_time', |
||
| 207 | 'autoFixDatabase', |
||
| 208 | 'allow_guestAccess', |
||
| 209 | 'time_format', |
||
| 210 | 'number_format', |
||
| 211 | 'enableBBC', |
||
| 212 | 'max_messageLength', |
||
| 213 | 'signature_settings', |
||
| 214 | 'autoOptMaxOnline', |
||
| 215 | 'defaultMaxMessages', |
||
| 216 | 'defaultMaxTopics', |
||
| 217 | 'defaultMaxMembers', |
||
| 218 | 'enableParticipation', |
||
| 219 | 'recycle_enable', |
||
| 220 | 'recycle_board', |
||
| 221 | 'maxMsgID', |
||
| 222 | 'enableAllMessages', |
||
| 223 | 'fixLongWords', |
||
| 224 | 'who_enabled', |
||
| 225 | 'time_offset', |
||
| 226 | 'cookieTime', |
||
| 227 | 'lastActive', |
||
| 228 | 'requireAgreement', |
||
| 229 | 'unapprovedMembers', |
||
| 230 | 'package_make_backups', |
||
| 231 | 'databaseSession_enable', |
||
| 232 | 'databaseSession_loose', |
||
| 233 | 'databaseSession_lifetime', |
||
| 234 | 'search_cache_size', |
||
| 235 | 'search_results_per_page', |
||
| 236 | 'search_weight_frequency', |
||
| 237 | 'search_weight_age', |
||
| 238 | 'search_weight_length', |
||
| 239 | 'search_weight_subject', |
||
| 240 | 'search_weight_first_message', |
||
| 241 | 'search_max_results', |
||
| 242 | 'search_floodcontrol_time', |
||
| 243 | 'permission_enable_deny', |
||
| 244 | 'permission_enable_postgroups', |
||
| 245 | 'mail_next_send', |
||
| 246 | 'mail_recent', |
||
| 247 | 'settings_updated', |
||
| 248 | 'next_task_time', |
||
| 249 | 'warning_settings', |
||
| 250 | 'admin_features', |
||
| 251 | 'last_mod_report_action', |
||
| 252 | 'pruningOptions', |
||
| 253 | 'cache_enable', |
||
| 254 | 'reg_verification', |
||
| 255 | 'enable_buddylist', |
||
| 256 | 'birthday_email', |
||
| 257 | 'globalCookies', |
||
| 258 | 'default_timezone', |
||
| 259 | 'memberlist_updated', |
||
| 260 | 'latestMember', |
||
| 261 | 'latestRealName', |
||
| 262 | 'db_mysql_group_by_fix', |
||
| 263 | 'rand_seed', |
||
| 264 | 'mostOnlineUpdated', |
||
| 265 | 'search_pointer', |
||
| 266 | 'spider_name_cache', |
||
| 267 | 'modlog_enabled', |
||
| 268 | 'disabledBBC', |
||
| 269 | 'latest_member', |
||
| 270 | 'latest_real_name', |
||
| 271 | 'total_members', |
||
| 272 | 'total_messages', |
||
| 273 | 'max_msg_id', |
||
| 274 | 'total_topics', |
||
| 275 | 'disable_hash_time', |
||
| 276 | 'latestreal_name', |
||
| 277 | 'disableHashTime', |
||
| 278 | ); |
||
| 279 | |||
| 280 | $request = $this->db->query(" |
||
| 281 | SELECT variable, value |
||
| 282 | FROM {$this->config->from_prefix}settings;"); |
||
| 283 | $rows = array(); |
||
| 284 | while ($row = $this->db->fetch_assoc($request)) |
||
| 285 | { |
||
| 286 | if (in_array($row['variable'], $do_import)) |
||
| 287 | { |
||
| 288 | $rows[] = array( |
||
| 289 | 'variable' => $row['variable'], |
||
| 290 | 'value' => $row['value'], |
||
| 291 | ); |
||
| 292 | } |
||
| 293 | } |
||
| 294 | $this->db->free_result($request); |
||
| 295 | |||
| 296 | return $rows; |
||
| 297 | } |
||
| 298 | |||
| 417 | } |