| Conditions | 1 |
| Paths | 1 |
| Total Lines | 69 |
| Code Lines | 52 |
| 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 |
||
| 48 | public function buildSettings(AbstractSettingsBuilder $builder) |
||
| 49 | { |
||
| 50 | $tools = $this->getProcessedToolChain(); |
||
| 51 | |||
| 52 | $builder |
||
| 53 | ->setDefaults( |
||
| 54 | [ |
||
| 55 | 'homepage_view' => 'activity_big', |
||
| 56 | 'show_tool_shortcuts' => 'false', // @todo check default value? |
||
| 57 | 'active_tools_on_create' => $tools, |
||
| 58 | 'display_coursecode_in_courselist' => 'false', |
||
| 59 | 'display_teacher_in_courselist' => 'true', |
||
| 60 | 'student_view_enabled' => 'true', |
||
| 61 | 'go_to_course_after_login' => 'false', |
||
| 62 | 'show_navigation_menu' => 'false', |
||
| 63 | 'enable_tool_introduction' => 'false', |
||
| 64 | 'breadcrumbs_course_homepage' => 'course_title', |
||
| 65 | 'example_material_course_creation' => 'true', |
||
| 66 | 'allow_course_theme' => 'true', |
||
| 67 | 'allow_users_to_create_courses' => 'true', |
||
| 68 | 'show_courses_descriptions_in_catalog' => 'true', |
||
| 69 | 'send_email_to_admin_when_create_course' => 'false', |
||
| 70 | 'allow_user_course_subscription_by_course_admin' => 'true', |
||
| 71 | 'course_validation' => 'false', |
||
| 72 | 'course_validation_terms_and_conditions_url' => '', |
||
| 73 | 'course_hide_tools' => [], |
||
| 74 | 'scorm_cumulative_session_time' => 'true', |
||
| 75 | 'courses_default_creation_visibility' => '2', |
||
| 76 | //COURSE_VISIBILITY_OPEN_PLATFORM |
||
| 77 | 'allow_public_certificates' => 'false', |
||
| 78 | 'allow_lp_return_link' => 'true', |
||
| 79 | 'course_creation_use_template' => null, |
||
| 80 | 'hide_scorm_export_link' => 'false', |
||
| 81 | 'hide_scorm_copy_link' => 'false', |
||
| 82 | 'hide_scorm_pdf_link' => 'true', |
||
| 83 | 'course_catalog_published' => 'false', |
||
| 84 | 'course_images_in_courses_list' => 'true', |
||
| 85 | 'teacher_can_select_course_template' => 'true', |
||
| 86 | 'show_toolshortcuts' => '', |
||
| 87 | 'enable_record_audio' => 'false', |
||
| 88 | 'lp_show_reduced_report' => 'false', |
||
| 89 | 'course_creation_splash_screen' => 'true', |
||
| 90 | 'block_registered_users_access_to_open_course_contents' => 'false', // @todo |
||
| 91 | ] |
||
| 92 | ) |
||
| 93 | ->setTransformer( |
||
| 94 | 'active_tools_on_create', |
||
| 95 | new ArrayToIdentifierTransformer() |
||
| 96 | ) |
||
| 97 | ->setTransformer( |
||
| 98 | 'course_hide_tools', |
||
| 99 | new ArrayToIdentifierTransformer() |
||
| 100 | ) |
||
| 101 | /* ->setTransformer( |
||
| 102 | 'course_creation_use_template', |
||
| 103 | new ResourceToIdentifierTransformer($this->getRepository()) |
||
| 104 | )*/ |
||
| 105 | ; |
||
| 106 | |||
| 107 | $allowedTypes = [ |
||
| 108 | 'homepage_view' => ['string'], |
||
| 109 | 'active_tools_on_create' => ['array'], |
||
| 110 | 'course_hide_tools' => ['array'], |
||
| 111 | 'display_coursecode_in_courselist' => ['string'], |
||
| 112 | 'display_teacher_in_courselist' => ['string'], |
||
| 113 | 'student_view_enabled' => ['string'], |
||
| 114 | ]; |
||
| 115 | |||
| 116 | $this->setMultipleAllowedTypes($allowedTypes, $builder); |
||
| 117 | } |
||
| 232 |