MetroType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 13 1
A configureOptions() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Form\Type;
6
7
use App\Entity\City;
8
use App\Entity\Metro;
9
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
10
use Symfony\Component\Form\AbstractType;
11
use Symfony\Component\Form\FormBuilderInterface;
12
use Symfony\Component\OptionsResolver\OptionsResolver;
13
14
final class MetroType extends AbstractType
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function buildForm(FormBuilderInterface $builder, array $options): void
20
    {
21
        $builder
22
            ->add('city', EntityType::class, [
23
                'class' => City::class,
24
                'choice_label' => 'name',
25
                'label' => 'city',
26
            ])
27
            ->add('name', null, [
28
                'label' => 'label.metro_station_name',
29
            ])
30
            ->add('slug', null, [
31
                'label' => 'label.slug',
32
            ]);
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function configureOptions(OptionsResolver $resolver): void
39
    {
40
        $resolver->setDefaults([
41
            'data_class' => Metro::class,
42
        ]);
43
    }
44
}
45