KeyValueType::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Maikuro\DistributedConfigurationBundle\Form;
4
5
use Symfony\Component\Form\AbstractType;
6
use Symfony\Component\Form\FormBuilderInterface;
7
use Symfony\Component\OptionsResolver\OptionsResolver;
8
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
9
10
/**
11
 * Class KeyValueType.
12
 */
13
class KeyValueType extends AbstractType
14
{
15
    /**
16
     * @param FormBuilderInterface $builder
17
     * @param array                $options
18
     */
19
    public function buildForm(FormBuilderInterface $builder, array $options)
20
    {
21
        $builder
22
            ->add('key')
23
            ->add('value')
24
        ;
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     * BC for SF < 2.7
30
     */
31
    public function setDefaultOptions(OptionsResolverInterface $resolver)
32
    {
33
        $this->configureOptions($resolver);
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function configureOptions(OptionsResolver $resolver)
40
    {
41
        $resolver->setDefaults([
42
            'data_class' => 'Maikuro\DistributedConfigurationBundle\Model\KeyValue',
43
            'csrf_protection' => false,
44
        ]);
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     * BC for SF < 3.0
50
     */
51
    public function getName()
52
    {
53
        return $this->getBlockPrefix();
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function getBlockPrefix()
60
    {
61
        return 'key_value';
62
    }
63
}
64