Completed
Pull Request — development (#825)
by
unknown
05:12
created

SupportSQLFlexForm::buildForm()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 51

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 51
rs 9.069
c 0
b 0
f 0

How to fix   Long Method   

Long Method

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:

1
<?php
2
3
namespace Oc\Form;
4
5
use Symfony\Component\Form\AbstractType;
6
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
7
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
8
use Symfony\Component\Form\FormBuilderInterface;
9
10
class SupportSQLFlexForm extends AbstractType
11
{
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