DealTypeType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 15 1
A configureOptions() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
/**
5
 * Created by PhpStorm.
6
 * User: Valery Maslov
7
 * Date: 12.08.2018
8
 * Time: 10:45.
9
 */
10
11
namespace App\Form\Type;
12
13
use App\Entity\DealType;
14
use Symfony\Component\Form\AbstractType;
15
use Symfony\Component\Form\FormBuilderInterface;
16
use Symfony\Component\OptionsResolver\OptionsResolver;
17
18
final class DealTypeType extends AbstractType
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function buildForm(FormBuilderInterface $builder, array $options): void
24
    {
25
        $builder
26
            ->add('name', null, [
27
                'attr' => [
28
                    'autofocus' => true,
29
                    'class' => 'form-control',
30
                ],
31
                'label' => 'label.name',
32
            ])
33
            ->add('slug', null, [
34
                'attr' => [
35
                    'class' => 'form-control',
36
                ],
37
                'label' => 'label.slug',
38
            ]);
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function configureOptions(OptionsResolver $resolver): void
45
    {
46
        $resolver->setDefaults([
47
            'data_class' => DealType::class,
48
        ]);
49
    }
50
}
51