| Conditions | 1 |
| Paths | 1 |
| Total Lines | 304 |
| Code Lines | 297 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 144 | public function getVariablesAndCategories() |
||
| 145 | { |
||
| 146 | $oldItems = [ |
||
| 147 | 'Institution' => 'Platform', |
||
| 148 | 'InstitutionUrl' => 'Platform', |
||
| 149 | 'siteName' => 'Platform', |
||
| 150 | 'emailAdministrator' => 'admin',//'emailAdministrator' => 'Platform', |
||
| 151 | 'administratorSurname' => 'admin', |
||
| 152 | 'administratorTelephone' => 'admin', |
||
| 153 | 'administratorName' => 'admin', |
||
| 154 | 'show_administrator_data' => 'Platform', |
||
| 155 | 'show_tutor_data' => 'Session', |
||
| 156 | 'show_teacher_data' => 'Platform', |
||
| 157 | 'homepage_view' => 'Course', |
||
| 158 | 'show_toolshortcuts' => 'Course', |
||
| 159 | 'allow_group_categories' => 'Course', |
||
| 160 | 'server_type' => 'Platform', |
||
| 161 | 'platformLanguage' => 'Languages', |
||
| 162 | 'showonline' => 'Platform', |
||
| 163 | 'profile' => 'User', |
||
| 164 | 'default_document_quotum' => 'Course', |
||
| 165 | 'registration' => 'User', |
||
| 166 | 'default_group_quotum' => 'Course', |
||
| 167 | 'allow_registration' => 'Platform', |
||
| 168 | 'allow_registration_as_teacher' => 'Platform', |
||
| 169 | 'allow_lostpassword' => 'Platform', |
||
| 170 | 'allow_user_headings' => 'Course', |
||
| 171 | 'allow_personal_agenda' => 'User', |
||
| 172 | 'display_coursecode_in_courselist' => 'Platform', |
||
| 173 | 'display_teacher_in_courselist' => 'Platform', |
||
| 174 | 'permanently_remove_deleted_files' => 'Tools', |
||
| 175 | 'dropbox_allow_overwrite' => 'Tools', |
||
| 176 | 'dropbox_max_filesize' => 'Tools', |
||
| 177 | 'dropbox_allow_just_upload' => 'Tools', |
||
| 178 | 'dropbox_allow_student_to_student' => 'Tools', |
||
| 179 | 'dropbox_allow_group' => 'Tools', |
||
| 180 | 'dropbox_allow_mailing' => 'Tools', |
||
| 181 | 'extended_profile' => 'User', |
||
| 182 | 'student_view_enabled' => 'Platform', |
||
| 183 | 'show_navigation_menu' => 'Course', |
||
| 184 | 'enable_tool_introduction' => 'course', |
||
| 185 | 'page_after_login' => 'Platform', |
||
| 186 | 'time_limit_whosonline' => 'Platform', |
||
| 187 | 'breadcrumbs_course_homepage' => 'Course', |
||
| 188 | 'example_material_course_creation' => 'Platform', |
||
| 189 | 'account_valid_duration' => 'Platform', |
||
| 190 | 'use_session_mode' => 'Session', |
||
| 191 | 'allow_email_editor' => 'Tools', |
||
| 192 | //'registered' => null', |
||
| 193 | //'donotlistcampus' =>'null', |
||
| 194 | 'show_email_addresses' => 'Platform', |
||
| 195 | 'service_ppt2lp' => 'NULL', |
||
| 196 | 'stylesheets' => 'stylesheets', |
||
| 197 | 'upload_extensions_list_type' => 'Security', |
||
| 198 | 'upload_extensions_blacklist' => 'Security', |
||
| 199 | 'upload_extensions_whitelist' => 'Security', |
||
| 200 | 'upload_extensions_skip' => 'Security', |
||
| 201 | 'upload_extensions_replace_by' => 'Security', |
||
| 202 | 'show_number_of_courses' => 'Platform', |
||
| 203 | 'show_empty_course_categories' => 'Platform', |
||
| 204 | 'show_back_link_on_top_of_tree' => 'Platform', |
||
| 205 | 'show_different_course_language' => 'Platform', |
||
| 206 | 'split_users_upload_directory' => 'Tuning', |
||
| 207 | 'hide_dltt_markup' => 'Languages', |
||
| 208 | 'display_categories_on_homepage' => 'Platform', |
||
| 209 | 'permissions_for_new_directories' => 'Security', |
||
| 210 | 'permissions_for_new_files' => 'Security', |
||
| 211 | 'show_tabs' => 'Platform', |
||
| 212 | 'default_forum_view' => 'Course', |
||
| 213 | 'platform_charset' => 'Languages', |
||
| 214 | 'noreply_email_address' => 'Platform', |
||
| 215 | 'survey_email_sender_noreply' => 'Course', |
||
| 216 | 'openid_authentication' => 'Security', |
||
| 217 | 'gradebook_enable' => 'Gradebook', |
||
| 218 | 'gradebook_score_display_coloring' => 'Gradebook', |
||
| 219 | 'gradebook_score_display_custom' => 'Gradebook', |
||
| 220 | 'gradebook_score_display_colorsplit' => 'Gradebook', |
||
| 221 | 'gradebook_score_display_upperlimit' => 'Gradebook', |
||
| 222 | 'gradebook_number_decimals' => 'Gradebook', |
||
| 223 | 'user_selected_theme' => 'Platform', |
||
| 224 | 'allow_course_theme' => 'Course', |
||
| 225 | 'show_closed_courses' => 'Platform', |
||
| 226 | 'extendedprofile_registration' => 'User', |
||
| 227 | 'extendedprofile_registrationrequired' => 'User', |
||
| 228 | 'add_users_by_coach' => 'Session', |
||
| 229 | 'extend_rights_for_coach' => 'Security', |
||
| 230 | 'extend_rights_for_coach_on_survey' => 'Security', |
||
| 231 | 'course_create_active_tools' => 'Tools', |
||
| 232 | 'show_session_coach' => 'Session', |
||
| 233 | 'allow_users_to_create_courses' => 'Platform', |
||
| 234 | 'allow_message_tool' => 'Tools', |
||
| 235 | 'allow_social_tool' => 'Tools', |
||
| 236 | 'allow_students_to_browse_courses' => 'Platform', |
||
| 237 | 'show_session_data' => 'Session', |
||
| 238 | 'allow_use_sub_language' => 'Languages', |
||
| 239 | 'show_glossary_in_documents' => 'Course', |
||
| 240 | 'allow_terms_conditions' => 'Platform', |
||
| 241 | 'search_enabled' => 'Search', |
||
| 242 | 'search_prefilter_prefix' => 'Search', |
||
| 243 | 'search_show_unlinked_results' => 'Search', |
||
| 244 | 'show_courses_descriptions_in_catalog' => 'Course', |
||
| 245 | 'allow_coach_to_edit_course_session' => 'Session', |
||
| 246 | 'show_glossary_in_extra_tools' => 'Course', |
||
| 247 | 'send_email_to_admin_when_create_course' => 'Platform', |
||
| 248 | 'go_to_course_after_login' => 'Course', |
||
| 249 | 'math_asciimathML' => 'Editor', |
||
| 250 | 'enabled_asciisvg' => 'Editor', |
||
| 251 | 'include_asciimathml_script' => 'Editor', |
||
| 252 | 'youtube_for_students' => 'Editor', |
||
| 253 | 'block_copy_paste_for_students' => 'Editor', |
||
| 254 | 'more_buttons_maximized_mode' => 'Editor', |
||
| 255 | 'students_download_folders' => 'Document', |
||
| 256 | 'users_copy_files' => 'Tools', |
||
| 257 | 'allow_students_to_create_groups_in_social' => 'Tools', |
||
| 258 | 'allow_send_message_to_all_platform_users' => 'Tools', |
||
| 259 | 'message_max_upload_filesize' => 'Tools', |
||
| 260 | 'use_users_timezone' => 'profile', //'use_users_timezone' => 'Timezones', |
||
| 261 | 'timezone_value' => 'platform',//'timezone_value' => 'Timezones', |
||
| 262 | 'allow_user_course_subscription_by_course_admin' => 'Security', |
||
| 263 | 'show_link_bug_notification' => 'Platform', |
||
| 264 | 'show_link_ticket_notification' => 'Platform', |
||
| 265 | 'course_validation' => 'course',//'course_validation' => 'Platform', |
||
| 266 | 'course_validation_terms_and_conditions_url' => 'Platform', |
||
| 267 | 'sso_authentication' => 'Security', |
||
| 268 | 'sso_authentication_domain' => 'Security', |
||
| 269 | 'sso_authentication_auth_uri' => 'Security', |
||
| 270 | 'sso_authentication_unauth_uri' => 'Security', |
||
| 271 | 'sso_authentication_protocol' => 'Security', |
||
| 272 | 'enabled_wiris' => 'Editor', |
||
| 273 | 'allow_spellcheck' => 'Editor', |
||
| 274 | 'force_wiki_paste_as_plain_text' => 'Editor', |
||
| 275 | 'enabled_googlemaps' => 'Editor', |
||
| 276 | 'enabled_imgmap' => 'Editor', |
||
| 277 | 'enabled_support_svg' => 'Tools', |
||
| 278 | 'pdf_export_watermark_enable' => 'Platform', |
||
| 279 | 'pdf_export_watermark_by_course' => 'Platform', |
||
| 280 | 'pdf_export_watermark_text' => 'Platform', |
||
| 281 | 'enabled_insertHtml' => 'Editor', |
||
| 282 | 'students_export2pdf' => 'Tools', |
||
| 283 | 'exercise_min_score' => 'Course', |
||
| 284 | 'exercise_max_score' => 'Course', |
||
| 285 | 'show_users_folders' => 'Tools', |
||
| 286 | 'show_default_folders' => 'Tools', |
||
| 287 | 'show_chat_folder' => 'Tools', |
||
| 288 | 'enabled_text2audio' => 'Tools', |
||
| 289 | 'course_hide_tools' => 'Tools', |
||
| 290 | 'enabled_support_pixlr' => 'Tools', |
||
| 291 | 'show_groups_to_users' => 'Session', |
||
| 292 | 'accessibility_font_resize' => 'Platform', |
||
| 293 | 'hide_courses_in_sessions' => 'Session', |
||
| 294 | 'enable_quiz_scenario' => 'Course', |
||
| 295 | 'filter_terms' => 'Security', |
||
| 296 | 'header_extra_content' => 'Tracking', |
||
| 297 | 'footer_extra_content' => 'Tracking', |
||
| 298 | 'show_documents_preview' => 'Tools', |
||
| 299 | 'htmlpurifier_wiki' => 'Editor', |
||
| 300 | 'cas_activate' => 'CAS', |
||
| 301 | 'cas_server' => 'CAS', |
||
| 302 | 'cas_server_uri' => 'CAS', |
||
| 303 | 'cas_port' => 'CAS', |
||
| 304 | 'cas_protocol' => 'CAS', |
||
| 305 | 'cas_add_user_activate' => 'CAS', |
||
| 306 | 'update_user_info_cas_with_ldap' => 'CAS', |
||
| 307 | 'student_page_after_login' => 'Platform', |
||
| 308 | 'teacher_page_after_login' => 'Platform', |
||
| 309 | 'drh_page_after_login' => 'Platform', |
||
| 310 | 'sessionadmin_page_after_login' => 'Session', |
||
| 311 | 'student_autosubscribe' => 'Platform', |
||
| 312 | 'teacher_autosubscribe' => 'Platform', |
||
| 313 | 'drh_autosubscribe' => 'Platform', |
||
| 314 | 'sessionadmin_autosubscribe' => 'Session', |
||
| 315 | 'scorm_cumulative_session_time' => 'Course', |
||
| 316 | 'allow_hr_skills_management' => 'Gradebook', |
||
| 317 | 'enable_help_link' => 'Platform', |
||
| 318 | 'teachers_can_change_score_settings' => 'Gradebook', |
||
| 319 | 'allow_users_to_change_email_with_no_password' => 'User', |
||
| 320 | 'show_admin_toolbar' => 'display', |
||
| 321 | 'allow_global_chat' => 'Platform', |
||
| 322 | 'languagePriority1' => 'Languages', |
||
| 323 | 'languagePriority2' => 'Languages', |
||
| 324 | 'languagePriority3' => 'Languages', |
||
| 325 | 'languagePriority4' => 'Languages', |
||
| 326 | 'login_is_email' => 'Platform', |
||
| 327 | 'courses_default_creation_visibility' => 'Course', |
||
| 328 | 'gradebook_enable_grade_model' => 'Gradebook', |
||
| 329 | 'teachers_can_change_grade_model_settings' => 'Gradebook', |
||
| 330 | 'gradebook_default_weight' => 'Gradebook', |
||
| 331 | 'ldap_description' => 'LDAP', |
||
| 332 | 'shibboleth_description' => 'Shibboleth', |
||
| 333 | 'facebook_description' => 'Facebook', |
||
| 334 | 'gradebook_locking_enabled' => 'Gradebook', |
||
| 335 | 'gradebook_default_grade_model_id' => 'Gradebook', |
||
| 336 | 'allow_session_admins_to_manage_all_sessions' => 'Session', |
||
| 337 | 'allow_skills_tool' => 'Platform', |
||
| 338 | 'allow_public_certificates' => 'Course', |
||
| 339 | 'platform_unsubscribe_allowed' => 'Platform', |
||
| 340 | 'activate_email_template' => 'Platform', |
||
| 341 | 'enable_iframe_inclusion' => 'Editor', |
||
| 342 | 'show_hot_courses' => 'Platform', |
||
| 343 | 'enable_webcam_clip' => 'Tools', |
||
| 344 | 'use_custom_pages' => 'Platform', |
||
| 345 | 'tool_visible_by_default_at_creation' => 'Tools', |
||
| 346 | 'prevent_session_admins_to_manage_all_users' => 'Session', |
||
| 347 | 'documents_default_visibility_defined_in_course' => 'Tools', |
||
| 348 | 'enabled_mathjax' => 'Editor', |
||
| 349 | 'meta_twitter_site' => 'Tracking', |
||
| 350 | 'meta_twitter_creator' => 'Tracking', |
||
| 351 | 'meta_title' => 'Tracking', |
||
| 352 | 'meta_description' => 'Tracking', |
||
| 353 | 'meta_image_path' => 'Tracking', |
||
| 354 | 'allow_teachers_to_create_sessions' => 'Session', |
||
| 355 | 'institution_address' => 'Platform', |
||
| 356 | 'chamilo_database_version' => 'null', |
||
| 357 | 'cron_remind_course_finished_activate' => 'Crons', |
||
| 358 | 'cron_remind_course_expiration_frequency' => 'Crons', |
||
| 359 | 'cron_remind_course_expiration_activate' => 'Crons', |
||
| 360 | 'allow_coach_feedback_exercises' => 'Session', |
||
| 361 | 'allow_my_files' => 'Platform', |
||
| 362 | 'ticket_allow_student_add' => 'Ticket', |
||
| 363 | 'ticket_send_warning_to_all_admins' => 'Ticket', |
||
| 364 | 'ticket_warn_admin_no_user_in_category' => 'Ticket', |
||
| 365 | 'ticket_allow_category_edition' => 'Ticket', |
||
| 366 | 'load_term_conditions_section' => 'Platform', |
||
| 367 | 'show_terms_if_profile_completed' => 'Ticket', |
||
| 368 | 'hide_home_top_when_connected' => 'Platform', |
||
| 369 | 'hide_global_announcements_when_not_connected' => 'Platform', |
||
| 370 | 'course_creation_use_template' => 'Course', |
||
| 371 | 'allow_strength_pass_checker' => 'Security', |
||
| 372 | 'allow_captcha' => 'Security', |
||
| 373 | 'captcha_number_mistakes_to_block_account' => 'Security', |
||
| 374 | 'captcha_time_to_block' => 'Security', |
||
| 375 | 'drh_can_access_all_session_content' => 'Session', |
||
| 376 | 'display_groups_forum_in_general_tool' => 'Tools', |
||
| 377 | 'allow_tutors_to_assign_students_to_session' => 'Session', |
||
| 378 | 'allow_lp_return_link' => 'Course', |
||
| 379 | 'hide_scorm_export_link' => 'Course', |
||
| 380 | 'hide_scorm_copy_link' => 'Course', |
||
| 381 | 'hide_scorm_pdf_link' => 'Course', |
||
| 382 | 'session_days_before_coach_access' => 'Session', |
||
| 383 | 'session_days_after_coach_access' => 'Session', |
||
| 384 | 'pdf_logo_header' => 'Course', |
||
| 385 | 'order_user_list_by_official_code' => 'Platform', |
||
| 386 | 'email_alert_manager_on_new_quiz' => 'Tools', |
||
| 387 | 'show_official_code_exercise_result_list' => 'Tools', |
||
| 388 | 'course_catalog_hide_private' => 'Platform', |
||
| 389 | 'catalog_show_courses_sessions' => 'Platform', |
||
| 390 | 'auto_detect_language_custom_pages' => 'Platform', |
||
| 391 | 'lp_show_reduced_report' => 'Tools', |
||
| 392 | 'allow_session_course_copy_for_teachers' => 'Session', |
||
| 393 | 'hide_logout_button' => 'Platform', |
||
| 394 | 'redirect_admin_to_courses_list' => 'Platform', |
||
| 395 | 'course_images_in_courses_list' => 'Course', |
||
| 396 | 'student_publication_to_take_in_gradebook' => 'Gradebook', |
||
| 397 | 'certificate_filter_by_official_code' => 'Gradebook', |
||
| 398 | 'exercise_max_ckeditors_in_page' => 'Tools', |
||
| 399 | 'document_if_file_exists_option' => 'Tools', |
||
| 400 | 'add_gradebook_certificates_cron_task_enabled' => 'Gradebook', |
||
| 401 | 'openbadges_backpack' => 'Gradebook', |
||
| 402 | 'cookie_warning' => 'Tools', |
||
| 403 | 'hide_course_group_if_no_tools_available' => 'Tools', |
||
| 404 | 'catalog_allow_session_auto_subscription' => 'Session', |
||
| 405 | 'registration.soap.php.decode_utf8' => 'Platform', |
||
| 406 | 'allow_delete_attendance' => 'Tools', |
||
| 407 | 'gravatar_enabled' => 'Platform', |
||
| 408 | 'gravatar_type' => 'Platform', |
||
| 409 | 'limit_session_admin_role' => 'Session', |
||
| 410 | 'show_session_description' => 'Session', |
||
| 411 | 'hide_certificate_export_link_students' => 'Gradebook', |
||
| 412 | 'hide_certificate_export_link' => 'Gradebook', |
||
| 413 | 'dropbox_hide_course_coach' => 'Tools', |
||
| 414 | 'dropbox_hide_general_coach' => 'Tools', |
||
| 415 | 'sso_force_redirect' => 'Security', |
||
| 416 | 'session_course_ordering' => 'Session', |
||
| 417 | 'gamification_mode' => 'Platform', |
||
| 418 | 'prevent_multiple_simultaneous_login' => 'Security', |
||
| 419 | 'gradebook_detailed_admin_view' => 'Gradebook', |
||
| 420 | 'course_catalog_published' => 'Course', |
||
| 421 | 'user_reset_password' => 'Security', |
||
| 422 | 'user_reset_password_token_limit' => 'Security', |
||
| 423 | 'my_courses_view_by_session' => 'Session', |
||
| 424 | 'show_full_skill_name_on_skill_wheel' => 'Platform', |
||
| 425 | 'messaging_allow_send_push_notification' => 'WebServices', |
||
| 426 | 'messaging_gdc_project_number' => 'WebServices', |
||
| 427 | 'messaging_gdc_api_key' => 'WebServices', |
||
| 428 | 'teacher_can_select_course_template' => 'Course', |
||
| 429 | 'enable_record_audio' => 'Tools', |
||
| 430 | 'allow_show_skype_account' => 'Platform', |
||
| 431 | 'allow_show_linkedin_url' => 'Platform', |
||
| 432 | 'enable_profile_user_address_geolocalization' => 'User', |
||
| 433 | 'show_official_code_whoisonline' => 'User', |
||
| 434 | 'icons_mode_svg' => 'display', |
||
| 435 | 'user_name_order' => 'display', |
||
| 436 | 'user_name_sort_by' => 'display', |
||
| 437 | 'default_calendar_view' => 'agenda', |
||
| 438 | 'exercise_invisible_in_session' => 'exercise', |
||
| 439 | 'configure_exercise_visibility_in_course' => 'exercise', |
||
| 440 | 'allow_download_documents_by_api_key' => 'Webservices', |
||
| 441 | 'ProfilingFilterAddingUsers' => 'profile', |
||
| 442 | 'donotlistcampus' => 'platform', |
||
| 443 | 'gradebook_show_percentage_in_reports' => 'gradebook', |
||
| 444 | |||
| 445 | ]; |
||
| 446 | |||
| 447 | return $oldItems; |
||
| 448 | } |
||
| 942 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return,dieorexitstatements that have been added for debug purposes.In the above example, the last
return falsewill never be executed, because a return statement has already been met in every possible execution path.