| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| 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 |
||
| 12 | public function buildForm(FormBuilderInterface $builder, array $options) |
||
| 13 | { |
||
| 14 | // see: https://symfonycasts.com/screencast/symfony-forms/form-type-class |
||
| 15 | $builder |
||
| 16 | ->add( |
||
| 17 | 'content_SELECT', ChoiceType::class, [ |
||
| 18 | 'choices' => ['SELECT' => 'SELECT'], |
||
| 19 | 'attr' => [ |
||
| 20 | 'style' => 'width: 300px;' |
||
| 21 | ], |
||
| 22 | 'disabled' => true, |
||
| 23 | 'label' => false, |
||
| 24 | 'trim' => true |
||
| 25 | ] |
||
| 26 | ) |
||
| 27 | ->add( |
||
| 28 | 'content_WHAT', null, [ |
||
| 29 | 'required' => true, |
||
| 30 | 'data' => '*', |
||
| 31 | 'attr' => [ |
||
| 32 | 'style' => 'width: 300px;' |
||
| 33 | ], |
||
| 34 | 'disabled' => false, |
||
| 35 | 'label' => false, |
||
| 36 | 'trim' => true |
||
| 37 | ] |
||
| 38 | ) |
||
| 39 | ->add( |
||
| 40 | 'content_FROM', ChoiceType::class, [ |
||
| 41 | 'choices' => ['FROM' => 'FROM'], |
||
| 42 | 'attr' => [ |
||
| 43 | 'style' => 'width: 300px;' |
||
| 44 | ], |
||
| 45 | 'disabled' => true, |
||
| 46 | 'label' => false, |
||
| 47 | 'trim' => true |
||
| 48 | ] |
||
| 49 | ) |
||
| 50 | ->add( |
||
| 51 | 'content_TABLE', ChoiceType::class, [ |
||
| 52 | 'choices' => ['caches' => 'caches', 'user' => 'user',], |
||
| 53 | 'attr' => [ |
||
| 54 | 'style' => 'width: 300px;' |
||
| 55 | ], |
||
| 56 | 'disabled' => false, |
||
| 57 | 'label' => false, |
||
| 58 | 'trim' => true |
||
| 59 | ] |
||
| 60 | ) |
||
| 61 | ->add('Suchen', SubmitType::class, ['attr' => ['class' => 'btn btn-primary']]); |
||
| 62 | } |
||
| 63 | } |
||
| 64 |