AttributeType   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 5 1
A setDefaultOptions() 0 6 1
A getName() 0 4 1
1
<?php
2
3
namespace Padam87\AttributeBundle\Form;
4
5
use Padam87\AttributeBundle\Form\EventListener\AttributeSubscriber;
6
use Symfony\Component\Form\AbstractType;
7
use Symfony\Component\Form\FormBuilderInterface;
8
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
9
10
class AttributeType extends AbstractType
11
{
12
    public function buildForm(FormBuilderInterface $builder, array $options)
13
    {
14
        $subscriber = new AttributeSubscriber($builder->getFormFactory());
15
        $builder->addEventSubscriber($subscriber);
16
    }
17
18
    public function setDefaultOptions(OptionsResolverInterface $resolver)
19
    {
20
        $resolver->setDefaults([
21
            'data_class' => 'Padam87\AttributeBundle\Entity\Attribute',
22
        ]);
23
    }
24
25
    public function getName()
26
    {
27
        return 'attribute';
28
    }
29
}
30