KeyValueType   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 51
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 7 1
A setDefaultOptions() 0 4 1
A configureOptions() 0 7 1
A getName() 0 4 1
A getBlockPrefix() 0 4 1
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