Conditions | 1 |
Paths | 1 |
Total Lines | 77 |
Code Lines | 64 |
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 |
||
76 | public function buildSettings(AbstractSettingsBuilder $builder): void |
||
77 | { |
||
78 | $toolChoices = $this->getFilteredToolChoices(); |
||
79 | |||
80 | $builder |
||
81 | ->setDefaults( |
||
82 | [ |
||
83 | 'active_tools_on_create' => array_values($toolChoices), |
||
84 | 'display_coursecode_in_courselist' => 'false', |
||
85 | 'display_teacher_in_courselist' => 'true', |
||
86 | 'student_view_enabled' => 'true', |
||
87 | 'show_navigation_menu' => 'false', |
||
88 | 'enable_tool_introduction' => 'false', |
||
89 | 'breadcrumbs_course_homepage' => 'course_title', |
||
90 | 'example_material_course_creation' => 'true', |
||
91 | 'allow_course_theme' => 'true', |
||
92 | 'send_email_to_admin_when_create_course' => 'false', |
||
93 | 'course_validation' => 'false', |
||
94 | 'course_validation_terms_and_conditions_url' => '', |
||
95 | 'course_hide_tools' => [], |
||
96 | 'scorm_cumulative_session_time' => 'true', |
||
97 | 'courses_default_creation_visibility' => '2', |
||
98 | 'course_creation_use_template' => null, |
||
99 | 'course_images_in_courses_list' => 'true', |
||
100 | 'show_toolshortcuts' => '', |
||
101 | 'course_creation_splash_screen' => 'true', |
||
102 | 'block_registered_users_access_to_open_course_contents' => 'false', |
||
103 | 'view_grid_courses' => 'true', |
||
104 | 'my_courses_show_courses_in_user_language_only' => 'false', |
||
105 | 'allow_public_course_with_no_terms_conditions' => 'false', |
||
106 | 'allow_base_course_category' => 'false', |
||
107 | 'hide_course_sidebar' => 'true', |
||
108 | 'multiple_access_url_show_shared_course_marker' => 'false', |
||
109 | 'course_category_code_to_use_as_model' => 'MY_CATEGORY', |
||
110 | 'enable_unsubscribe_button_on_my_course_page' => 'false', |
||
111 | 'course_creation_donate_message_show' => 'false', |
||
112 | 'course_creation_donate_link' => '<some donate button html>', |
||
113 | 'hide_course_rating' => 'false', |
||
114 | 'course_log_hide_columns' => '', |
||
115 | 'course_student_info' => '', |
||
116 | 'resource_sequence_show_dependency_in_course_intro' => 'false', |
||
117 | 'course_sequence_valid_only_in_same_session' => 'false', |
||
118 | 'course_creation_form_set_course_category_mandatory' => 'false', |
||
119 | 'course_creation_form_hide_course_code' => 'false', |
||
120 | 'course_about_teacher_name_hide' => 'false', |
||
121 | 'course_log_default_extra_fields' => '', |
||
122 | 'course_creation_by_teacher_extra_fields_to_show' => '', |
||
123 | 'course_creation_form_set_extra_fields_mandatory' => '', |
||
124 | 'course_configuration_tool_extra_fields_to_show_and_edit' => '', |
||
125 | 'course_creation_user_course_extra_field_relation_to_prefill' => '', |
||
126 | 'show_course_duration' => 'false', |
||
127 | 'profiling_filter_adding_users' => 'false', |
||
128 | ] |
||
129 | ) |
||
130 | ->setTransformer( |
||
131 | 'active_tools_on_create', |
||
132 | new ArrayToIdentifierTransformer() |
||
133 | ) |
||
134 | ->setTransformer( |
||
135 | 'course_hide_tools', |
||
136 | new ArrayToIdentifierTransformer() |
||
137 | ) |
||
138 | ->setTransformer( |
||
139 | 'course_creation_use_template', |
||
140 | new ResourceToIdentifierTransformer($this->courseRepository, 'id') |
||
141 | ) |
||
142 | ; |
||
143 | |||
144 | $allowedTypes = [ |
||
145 | 'active_tools_on_create' => ['array'], |
||
146 | 'course_hide_tools' => ['array'], |
||
147 | 'display_coursecode_in_courselist' => ['string'], |
||
148 | 'display_teacher_in_courselist' => ['string'], |
||
149 | 'student_view_enabled' => ['string'], |
||
150 | ]; |
||
151 | |||
152 | $this->setMultipleAllowedTypes($allowedTypes, $builder); |
||
153 | } |
||
260 |