FeatureType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 13
dl 0
loc 30
rs 10
c 1
b 0
f 1
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
namespace App\Form\Type;
6
7
use App\Entity\Feature;
8
use Symfony\Component\Form\AbstractType;
9
use Symfony\Component\Form\FormBuilderInterface;
10
use Symfony\Component\OptionsResolver\OptionsResolver;
11
12
final class FeatureType extends AbstractType
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function buildForm(FormBuilderInterface $builder, array $options): void
18
    {
19
        $builder
20
            ->add('name', null, [
21
                'attr' => [
22
                    'autofocus' => true,
23
                ],
24
                'label' => 'label.feature',
25
            ])
26
            ->add('icon', null, [
27
                'attr' => [
28
                    'rows' => '1',
29
                    'placeholder' => 'placeholder.example_icon',
30
                ],
31
                'label' => 'label.custom_icon',
32
            ]);
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function configureOptions(OptionsResolver $resolver): void
39
    {
40
        $resolver->setDefaults([
41
            'data_class' => Feature::class,
42
        ]);
43
    }
44
}
45