| Conditions | 1 |
| Paths | 1 |
| Total Lines | 52 |
| Code Lines | 39 |
| 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 |
||
| 55 | public function buildForm(FormBuilderInterface $builder): void |
||
| 56 | { |
||
| 57 | $extendedProfileOptions = [ |
||
| 58 | 'MyCompetences' => 'mycompetences', |
||
| 59 | 'MyDiplomas' => 'mydiplomas', |
||
| 60 | 'MyTeach' => 'myteach', |
||
| 61 | 'MyPersonalOpenArea' => 'mypersonalopenarea', |
||
| 62 | ]; |
||
| 63 | |||
| 64 | $builder |
||
| 65 | ->add('required_profile_fields', ChoiceType::class, [ |
||
| 66 | 'multiple' => true, |
||
| 67 | 'choices' => [ |
||
| 68 | 'Official code' => 'officialcode', |
||
| 69 | 'E-mail' => 'email', |
||
| 70 | 'Language' => 'language', |
||
| 71 | 'Phone' => 'phone', |
||
| 72 | ], |
||
| 73 | ]) |
||
| 74 | ->add('allow_registration', ChoiceType::class, [ |
||
| 75 | 'choices' => [ |
||
| 76 | 'Yes' => 'true', |
||
| 77 | 'No' => 'false', |
||
| 78 | 'Mail confirmation' => 'confirmation', |
||
| 79 | 'Approval' => 'approval', |
||
| 80 | ], |
||
| 81 | ]) |
||
| 82 | ->add('allow_registration_as_teacher', YesNoType::class) |
||
| 83 | ->add('allow_lostpassword', YesNoType::class) |
||
| 84 | ->add('extendedprofile_registration', ChoiceType::class, [ |
||
| 85 | 'multiple' => true, |
||
| 86 | 'choices' => $extendedProfileOptions, |
||
| 87 | ]) |
||
| 88 | ->add('extendedprofile_registrationrequired', ChoiceType::class, [ |
||
| 89 | 'multiple' => true, |
||
| 90 | 'choices' => $extendedProfileOptions, |
||
| 91 | ]) |
||
| 92 | ->add('allow_terms_conditions', YesNoType::class) |
||
| 93 | ->add('student_autosubscribe') |
||
| 94 | ->add('teacher_autosubscribe') |
||
| 95 | ->add('drh_autosubscribe') |
||
| 96 | ->add('sessionadmin_autosubscribe') |
||
| 97 | ->add('platform_unsubscribe_allowed', YesNoType::class) |
||
| 98 | ->add('required_extra_fields_in_inscription', TextareaType::class) |
||
| 99 | ->add('allow_fields_inscription', TextareaType::class) |
||
| 100 | ->add('send_inscription_msg_to_inbox', YesNoType::class) |
||
| 101 | ->add('redirect_after_login', TextareaType::class, [ |
||
| 102 | 'required' => false, |
||
| 103 | ]) |
||
| 104 | ; |
||
| 105 | |||
| 106 | $this->updateFormFieldsFromSettingsInfo($builder); |
||
| 107 | } |
||
| 109 |