| Conditions | 1 |
| Paths | 1 |
| Total Lines | 58 |
| 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 |
||
| 46 | public function configureEditForm(FormMapper $formMapper, BlockInterface $block): void |
||
| 47 | { |
||
| 48 | $formMapper->add('settings', ImmutableArrayType::class, [ |
||
| 49 | 'keys' => [ |
||
| 50 | ['url', TextType::class, [ |
||
| 51 | 'label' => 'form.label_url', |
||
| 52 | 'required' => false, |
||
| 53 | ]], |
||
| 54 | ['class', TextType::class, [ |
||
| 55 | 'label' => 'form.label_class', |
||
| 56 | 'required' => false, |
||
| 57 | ]], |
||
| 58 | ['services', ChoiceType::class, [ |
||
| 59 | 'label' => 'form.label_services', |
||
| 60 | 'choices' => [ |
||
| 61 | 'form.choice_twitter' => 'twitter', |
||
| 62 | 'form.choice_facebook' => 'facebook', |
||
| 63 | 'form.choice_googleplus' => 'googleplus', |
||
| 64 | 'form.choice_addthis' => 'addthis', |
||
| 65 | 'form.choice_linkedin' => 'linkedin', |
||
| 66 | 'form.choice_reddit' => 'reddit', |
||
| 67 | 'form.choice_stumbleupon' => 'stumbleupon', |
||
| 68 | 'form.choice_flattr' => 'flattr', |
||
| 69 | 'form.choice_pinterest' => 'pinterest', |
||
| 70 | 'form.choice_xing' => 'xing', |
||
| 71 | 'form.choice_mail' => 'mail', |
||
| 72 | ], |
||
| 73 | 'required' => false, |
||
| 74 | 'multiple' => true, |
||
| 75 | ]], |
||
| 76 | ['theme', ChoiceType::class, [ |
||
| 77 | 'label' => 'form.label_theme', |
||
| 78 | 'choices' => [ |
||
| 79 | 'standard' => 'standard', |
||
| 80 | 'grey' => 'grey', |
||
| 81 | 'white' => 'white', |
||
| 82 | ], |
||
| 83 | 'choice_translation_domain' => false, |
||
| 84 | ]], |
||
| 85 | ['orientation', ChoiceType::class, [ |
||
| 86 | 'label' => 'form.label_orientation', |
||
| 87 | 'choices' => [ |
||
| 88 | 'form.choice_vertical' => 'vertical', |
||
| 89 | 'form.choice_horizontal' => 'horizontal', |
||
| 90 | ], |
||
| 91 | ]], |
||
| 92 | ['flattrUser', TextType::class, [ |
||
| 93 | 'label' => 'form.label_flattr_user', |
||
| 94 | 'required' => false, |
||
| 95 | ]], |
||
| 96 | ['flattrCategory', TextType::class, [ |
||
| 97 | 'label' => 'form.label_flattr_category', |
||
| 98 | 'required' => false, |
||
| 99 | ]], |
||
| 100 | ], |
||
| 101 | 'translation_domain' => 'Core23ShariffBundle', |
||
| 102 | ]); |
||
| 103 | } |
||
| 104 | |||
| 130 |