SingleLineTextPagePartAdminType::buildForm()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 44

Duplication

Lines 41
Ratio 93.18 %

Code Coverage

Tests 22
CRAP Score 1

Importance

Changes 0
Metric Value
dl 41
loc 44
ccs 22
cts 22
cp 1
rs 9.216
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Kunstmaan\FormBundle\Form;
4
5
use Symfony\Component\Form\AbstractType;
6
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
7
use Symfony\Component\Form\Extension\Core\Type\TextType;
8
use Symfony\Component\Form\FormBuilderInterface;
9
use Symfony\Component\OptionsResolver\OptionsResolver;
10
11
/**
12
 * This class represents the type for the SubleLineTextPagePart
13
 */
14 View Code Duplication
class SingleLineTextPagePartAdminType extends AbstractType
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
{
16
    /**
17
     * @param FormBuilderInterface $builder The form builder
18
     * @param array                $options The options
19
     */
20 1
    public function buildForm(FormBuilderInterface $builder, array $options)
21
    {
22
        $builder
23 1
            ->add(
24 1
                'label',
25 1
                TextType::class,
26
                [
27 1
                    'required' => true,
28
                    'label' => 'kuma_form.form.single_line_text_page_part.label.label',
29
                ]
30
            )
31 1
            ->add(
32 1
                'required',
33 1
                CheckboxType::class,
34
                [
35 1
                    'required' => false,
36
                    'label' => 'kuma_form.form.single_line_text_page_part.required.label',
37
                ]
38
            )
39 1
            ->add(
40 1
                'errormessage_required',
41 1
                TextType::class,
42
                [
43 1
                    'required' => false,
44
                    'label' => 'kuma_form.form.single_line_text_page_part.errormessage_required.label',
45
                ]
46
            )
47 1
            ->add(
48 1
                'regex',
49 1
                TextType::class,
50
                [
51 1
                    'required' => false,
52
                    'label' => 'kuma_form.form.single_line_text_page_part.regex.label',
53
                ]
54
            )
55 1
            ->add(
56 1
                'errormessage_regex',
57 1
                TextType::class,
58
                [
59 1
                    'required' => false,
60
                    'label' => 'kuma_form.form.single_line_text_page_part.errormessage_regex.label',
61
                ]
62
            );
63 1
    }
64
65
    /**
66
     * @return string
67
     */
68 1
    public function getBlockPrefix()
69
    {
70 1
        return 'kunstmaan_formbundle_singlelinetextpageparttype';
71
    }
72
73
    /**
74
     * @param OptionsResolver $resolver
75
     */
76 1
    public function configureOptions(OptionsResolver $resolver)
77
    {
78 1
        $resolver->setDefaults(['data_class' => 'Kunstmaan\FormBundle\Entity\PageParts\SingleLineTextPagePart']);
79 1
    }
80
}
81