HTPayWayOffsiteGatewayConfigurationType   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 39
dl 0
loc 69
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 64 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Locastic\SyliusHTPayWayPlugin\Form\Type;
6
7
use Symfony\Component\Form\AbstractType;
8
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
9
use Symfony\Component\Form\Extension\Core\Type\TextType;
10
use Symfony\Component\Form\FormBuilderInterface;
11
use Symfony\Component\Validator\Constraints\NotBlank;
12
13
final class HTPayWayOffsiteGatewayConfigurationType extends AbstractType
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function buildForm(FormBuilderInterface $builder, array $options): void
19
    {
20
        $builder
21
            ->add(
22
                'sandbox',
23
                ChoiceType::class,
24
                [
25
                    'choices' => [
26
                        'locastic.sylius_ht_payway_plugin.form.yes' => 1,
27
                        'locastic.sylius_ht_payway_plugin.form.no' => 0,
28
                    ],
29
                    'label' => 'locastic.sylius_ht_payway_plugin.form.sandbox',
30
                ]
31
            )
32
            ->add(
33
                'shop_id',
34
                TextType::class,
35
                [
36
                    'label' => 'locastic.sylius_ht_payway_plugin.form.shop_id',
37
                    'constraints' => [
38
                        new NotBlank(
39
                            [
40
                                'message' => 'locastic.sylius_ht_payway_plugin.form.shop_id_not_blank',
41
                                'groups' => ['sylius'],
42
                            ]
43
                        ),
44
                    ],
45
                ]
46
            )
47
            ->add(
48
                'secret_key',
49
                TextType::class,
50
                [
51
                    'label' => 'locastic.sylius_ht_payway_plugin.form.secret_key',
52
                    'constraints' => [
53
                        new NotBlank(
54
                            [
55
                                'message' => 'locastic.sylius_ht_payway_plugin.form.secret_key_not_blank',
56
                                'groups' => ['sylius'],
57
                            ]
58
                        ),
59
                    ],
60
                ]
61
            )
62
            ->add(
63
                'authorization_type',
64
                ChoiceType::class,
65
                [
66
                    'choices' => [
67
                        'locastic.sylius_ht_payway_plugin.form.yes' => 0,
68
                        'locastic.sylius_ht_payway_plugin.form.no' => 1,
69
                    ],
70
                    'label' => 'locastic.sylius_ht_payway_plugin.form.authorization_type',
71
                ]
72
            )
73
            ->add(
74
                'disable_installments',
75
                ChoiceType::class,
76
                [
77
                    'choices' => [
78
                        'locastic.sylius_ht_payway_plugin.form.yes' => 1,
79
                        'locastic.sylius_ht_payway_plugin.form.no' => 0,
80
                    ],
81
                    'label' => 'locastic.sylius_ht_payway_plugin.form.disable_installments',
82
                ]
83
            );
84
    }
85
}