Completed
Pull Request — development (#829)
by
unknown
04:57
created

SupportSQLFlexForm::buildForm()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 56

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 56
rs 8.9599
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
/**
11
 * Class SupportSQLFlexForm
12
 *
13
 * @package Oc\Form
14
 */
15
class SupportSQLFlexForm extends AbstractType
16
{
17
    public function buildForm(FormBuilderInterface $builder, array $options)
18
    {
19
        // see: https://symfonycasts.com/screencast/symfony-forms/form-type-class
20
        $builder
21
            ->add(
22
                'content_SELECT', ChoiceType::class, [
23
                                    'choices' => ['SELECT' => 'SELECT'],
24
                                    'attr' => [
25
                                        'style' => 'width: 180px;'
26
                                    ],
27
                                    'disabled' => true,
28
                                    'label' => false,
29
                                    'trim' => true
30
                                ]
31
            )
32
            ->add(
33
                'content_WHAT', null, [
34
                                  'required' => true,
35
                                  'data' => '*',
36
                                  'attr' => [
37
                                      'style' => 'width: 180px;'
38
                                  ],
39
                                  'disabled' => false,
40
                                  'label' => false,
41
                                  'trim' => true
42
                              ]
43
            )
44
            ->add(
45
                'content_FROM', ChoiceType::class, [
46
                                  'choices' => ['FROM' => 'FROM'],
47
                                  'attr' => [
48
                                      'style' => 'width: 180px;'
49
                                  ],
50
                                  'disabled' => true,
51
                                  'label' => false,
52
                                  'trim' => true
53
                              ]
54
            )
55
            ->add(
56
                'content_TABLE', ChoiceType::class, [
57
                                   'choices' => ['caches' => 'caches', 'user' => 'user'],
58
                                   'attr' => [
59
                                       'style' => 'width: 180px;'
60
                                   ],
61
                                   'disabled' => false,
62
                                   'label' => false,
63
                                   'trim' => true
64
                               ]
65
            )
66
            ->add(
67
                'Suchen', SubmitType::class, [
68
                'attr' => ['class' => 'btn btn-primary'],
69
                'label' => '🔍'
70
            ]
71
            );
72
    }
73
}
74