YamlType   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 0
cbo 4
dl 0
loc 40
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getParent() 0 4 1
A getName() 0 4 1
A buildForm() 0 6 1
A setDefaultOptions() 0 8 1
1
<?php
2
3
namespace DoS\ResourceBundle\Form\Type;
4
5
use DoS\ResourceBundle\Form\DataTransformer\YamlTransformer;
6
use Symfony\Component\Form\AbstractType;
7
use Symfony\Component\Form\FormBuilderInterface;
8
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
9
10
class YamlType extends AbstractType
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function buildForm(FormBuilderInterface $builder, array $options)
16
    {
17
        $builder
18
            ->addModelTransformer(new YamlTransformer($options['inline_level']))
19
        ;
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function setDefaultOptions(OptionsResolverInterface $resolver)
26
    {
27
        parent::setDefaultOptions($resolver);
28
29
        $resolver->setDefaults(array(
30
            'inline_level' => 10,
31
        ));
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function getParent()
38
    {
39
        return 'textarea';
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function getName()
46
    {
47
        return 'dos_yaml';
48
    }
49
}
50