IdentityType::configureOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/*
3
 * This file is part of the FreshSinchBundle
4
 *
5
 * (c) Artem Henvald <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
declare(strict_types=1);
12
13
namespace Fresh\SinchBundle\Form\Type;
14
15
use Fresh\SinchBundle\Model\Identity;
16
use Symfony\Component\Form\AbstractType;
17
use Symfony\Component\Form\Extension\Core\Type as CoreType;
18
use Symfony\Component\Form\FormBuilderInterface;
19
use Symfony\Component\OptionsResolver\OptionsResolver;
20
21
/**
22
 * IdentityType.
23
 *
24
 * @author Artem Henvald <[email protected]>
25
 */
26
class IdentityType extends AbstractType
27
{
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function buildForm(FormBuilderInterface $builder, array $options): void
32
    {
33
        $builder
34
            ->add('type', CoreType\TextType::class, [
35
                'required' => true,
36
            ])
37
            ->add('endpoint', CoreType\TextType::class, [
38
                'required' => true,
39
            ]);
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function configureOptions(OptionsResolver $resolver): void
46
    {
47
        $resolver->setDefaults([
48
            'data_class' => Identity::class,
49
            'csrf_protection' => false,
50
        ]);
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function getBlockPrefix(): string
57
    {
58
        return '';
59
    }
60
}
61