Conditions | 1 |
Paths | 1 |
Total Lines | 64 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | 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 |
||
33 | public function buildForm(FormBuilderInterface $builder, array $options): void |
||
34 | { |
||
35 | $languages = array_flip($this->languageRepository->getAllAvailableToArray()); |
||
36 | |||
37 | $builder |
||
38 | ->add('firstname', TextType::class, ['label' => 'Firstname', 'required' => true]) |
||
39 | ->add('lastname', TextType::class, ['label' => 'Lastname', 'required' => true]) |
||
40 | ->add('email', EmailType::class, ['label' => 'Email', 'required' => true]) |
||
41 | //->add('official_code', TextType::class) |
||
42 | //->add('groups') |
||
43 | ->add('locale', LocaleType::class, [ |
||
44 | //'preferred_choices' => ['en', 'fr_FR', 'es_ES', 'pt', 'nl'], |
||
45 | 'choices' => $languages, |
||
46 | 'choice_loader' => null, |
||
47 | ]) |
||
48 | /*->add( 'dateOfBirth', |
||
49 | BirthdayType::class, |
||
50 | [ |
||
51 | 'label' => 'form.label_date_of_birth', |
||
52 | 'required' => false, |
||
53 | 'widget' => 'single_text', |
||
54 | ] |
||
55 | ) |
||
56 | ->add( |
||
57 | 'biography', |
||
58 | TextareaType::class, |
||
59 | [ |
||
60 | 'label' => 'form.label_biography', |
||
61 | 'required' => false, |
||
62 | ] |
||
63 | )*/ |
||
64 | /*->add('locale', 'locale', array( |
||
65 | 'label' => 'form.label_locale', |
||
66 | 'required' => false, |
||
67 | ))*/ |
||
68 | ->add('timezone', TimezoneType::class, ['label' => 'Timezone', 'required' => true]) |
||
69 | ->add('phone', TextType::class, ['label' => 'Phone number', 'required' => false]) |
||
70 | ->add( |
||
71 | 'illustration', |
||
72 | IllustrationType::class, |
||
73 | ['label' => 'Picture', 'required' => false, 'mapped' => false] |
||
74 | ) |
||
75 | //->add('website', UrlType::class, ['label' => 'Website', 'required' => false]) |
||
76 | /*->add( |
||
77 | 'extraFieldValues', |
||
78 | CollectionType::class, |
||
79 | array( |
||
80 | 'required' => false, |
||
81 | 'allow_add' => true, |
||
82 | 'allow_delete' => true, |
||
83 | 'type' => 'chamilo_user_extra_field_value', |
||
84 | 'by_reference' => false, |
||
85 | 'prototype' => true, |
||
86 | 'widget_add_btn' => ['label' => 'Add'], |
||
87 | 'options' => array( // options for collection fields |
||
88 | 'widget_remove_btn' => array('label' => 'Remove'), |
||
89 | 'label_render' => false, |
||
90 | ) |
||
91 | ) |
||
92 | )*/ |
||
93 | //->add('save', 'submit', array('label' => 'Update') ) |
||
94 | ; |
||
95 | |||
96 | $builder->add('extra_fields', ExtraFieldType::class, ['mapped' => false]); |
||
97 | } |
||
108 |