Conditions | 1 |
Paths | 1 |
Total Lines | 160 |
Code Lines | 114 |
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 |
||
116 | public function buildForm(FormBuilderInterface $builder): void |
||
117 | { |
||
118 | $builder |
||
119 | ->add('institution') |
||
120 | ->add('institution_url', UrlType::class) |
||
121 | ->add('institution_address') |
||
122 | ->add('site_name') |
||
123 | ->add('timezone', TimezoneType::class) |
||
124 | ->add('gravatar_enabled', YesNoType::class) |
||
125 | ->add( |
||
126 | 'gravatar_type', |
||
127 | ChoiceType::class, |
||
128 | [ |
||
129 | 'choices' => [ |
||
130 | 'mistery-man' => 'mm', |
||
131 | 'identicon' => 'identicon', |
||
132 | 'monsterid' => 'monsterid', |
||
133 | 'wavatar' => 'wavatar', |
||
134 | ], |
||
135 | ] |
||
136 | ) |
||
137 | ->add('gamification_mode') |
||
138 | ->add('order_user_list_by_official_code', YesNoType::class) |
||
139 | ->add('cookie_warning', YesNoType::class) |
||
140 | ->add('donotlistcampus', YesNoType::class) |
||
141 | ->add('course_catalog_hide_private', YesNoType::class) |
||
142 | ->add( |
||
143 | 'catalog_show_courses_sessions', |
||
144 | ChoiceType::class, |
||
145 | [ |
||
146 | 'choices' => [ |
||
147 | 'Hide catalogue' => '-1', |
||
148 | 'Show only courses' => '0', |
||
149 | 'Show only sessions' => '1', |
||
150 | 'Show courses and sessions' => '2', |
||
151 | ], |
||
152 | ] |
||
153 | ) |
||
154 | ->add('use_custom_pages', YesNoType::class) |
||
155 | ->add('pdf_logo_header') |
||
156 | ->add('allow_my_files', YesNoType::class) |
||
157 | // old settings with no category |
||
158 | ->add('chamilo_database_version') |
||
159 | ->add( |
||
160 | 'load_term_conditions_section', |
||
161 | ChoiceType::class, |
||
162 | [ |
||
163 | 'choices' => [ |
||
164 | 'Login' => 'login', |
||
165 | 'Course' => 'course', |
||
166 | ], |
||
167 | ] |
||
168 | ) |
||
169 | ->add( |
||
170 | 'show_tabs', |
||
171 | ChoiceType::class, |
||
172 | [ |
||
173 | 'multiple' => true, |
||
174 | 'choices' => self::$tabs |
||
175 | ], |
||
176 | ) |
||
177 | ->add( |
||
178 | 'unoconv_binaries', |
||
179 | TextType::class |
||
180 | ) |
||
181 | ->add('hide_main_navigation_menu', YesNoType::class) |
||
182 | ->add('pdf_img_dpi', TextType::class) |
||
183 | ->add('tracking_skip_generic_data', YesNoType::class) |
||
184 | ->add('hide_complete_name_in_whoisonline', YesNoType::class) |
||
185 | ->add('table_default_row', TextType::class) |
||
186 | ->add('allow_double_validation_in_registration', YesNoType::class) |
||
187 | ->add('block_my_progress_page', YesNoType::class) |
||
188 | ->add('generate_random_login', YesNoType::class) |
||
189 | ->add('timepicker_increment', TextType::class) |
||
190 | ->add( |
||
191 | 'proxy_settings', |
||
192 | TextareaType::class, |
||
193 | [ |
||
194 | 'help_html' => true, |
||
195 | 'help' => $this->settingArrayHelpValue('proxy_settings'), |
||
196 | ] |
||
197 | ) |
||
198 | ->add( |
||
199 | 'video_features', |
||
200 | TextareaType::class, |
||
201 | [ |
||
202 | 'help_html' => true, |
||
203 | 'help' => $this->settingArrayHelpValue('video_features'), |
||
204 | ] |
||
205 | ) |
||
206 | ->add( |
||
207 | 'table_row_list', |
||
208 | TextareaType::class, |
||
209 | [ |
||
210 | 'help_html' => true, |
||
211 | 'help' => $this->settingArrayHelpValue('table_row_list'), |
||
212 | ] |
||
213 | ) |
||
214 | ->add('webservice_return_user_field', TextType::class) |
||
215 | ->add('multiple_url_hide_disabled_settings', YesNoType::class) |
||
216 | ->add('login_max_attempt_before_blocking_account', TextType::class) |
||
217 | ->add('force_renew_password_at_first_login', YesNoType::class) |
||
218 | ->add('hide_breadcrumb_if_not_allowed', YesNoType::class) |
||
219 | ->add( |
||
220 | 'extldap_config', |
||
221 | TextareaType::class, |
||
222 | [ |
||
223 | 'help_html' => true, |
||
224 | 'help' => $this->settingArrayHelpValue('extldap_config'), |
||
225 | ] |
||
226 | ) |
||
227 | ->add( |
||
228 | 'update_student_expiration_x_date', |
||
229 | TextareaType::class, |
||
230 | [ |
||
231 | 'help_html' => true, |
||
232 | 'help' => $this->settingArrayHelpValue('update_student_expiration_x_date'), |
||
233 | ] |
||
234 | ) |
||
235 | ->add('user_status_show_options_enabled', YesNoType::class) |
||
236 | ->add( |
||
237 | 'user_status_show_option', |
||
238 | TextareaType::class, |
||
239 | [ |
||
240 | 'help_html' => true, |
||
241 | 'help' => $this->settingArrayHelpValue('user_status_show_option'), |
||
242 | ] |
||
243 | ) |
||
244 | ->add( |
||
245 | 'user_number_of_days_for_default_expiration_date_per_role', |
||
246 | TextareaType::class, |
||
247 | [ |
||
248 | 'help_html' => true, |
||
249 | 'help' => $this->settingArrayHelpValue('user_number_of_days_for_default_expiration_date_per_role'), |
||
250 | ] |
||
251 | ) |
||
252 | ->add('user_edition_extra_field_to_check', TextType::class) |
||
253 | ->add('user_hide_never_expire_option', YesNoType::class) |
||
254 | ->add('platform_logo_url', TextType::class) |
||
255 | ->add('use_career_external_id_as_identifier_in_diagrams', YesNoType::class) |
||
256 | ->add('disable_webservices', YesNoType::class) |
||
257 | ->add('webservice_enable_adminonly_api', YesNoType::class) |
||
258 | ->add('allow_working_time_edition', YesNoType::class) |
||
259 | ->add('disable_user_conditions_sender_id', TextType::class) |
||
260 | ->add('portfolio_advanced_sharing', TextType::class) |
||
261 | ->add('redirect_index_to_url_for_logged_users', TextType::class) |
||
262 | ->add( |
||
263 | 'default_menu_entry_for_course_or_session', |
||
264 | ChoiceType::class, |
||
265 | [ |
||
266 | 'choices' => [ |
||
267 | 'My courses' => 'my_courses', |
||
268 | 'My sessions' => 'my_sessions', |
||
269 | ], |
||
270 | ] |
||
271 | ) |
||
272 | ->add('notification_event', YesNoType::class) |
||
273 | ; |
||
274 | |||
275 | $this->updateFormFieldsFromSettingsInfo($builder); |
||
276 | } |
||
350 |