Przelewy24GatewayConfigurationType   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 39
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 36 1
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * another great project.
7
 * You can find more information about us on https://bitbag.shop and write us
8
 * an email on [email protected].
9
 */
10
11
declare(strict_types=1);
12
13
namespace BitBag\SyliusPrzelewy24Plugin\Form\Type;
14
15
use BitBag\SyliusPrzelewy24Plugin\Bridge\Przelewy24BridgeInterface;
16
use Symfony\Component\Form\AbstractType;
17
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
18
use Symfony\Component\Form\Extension\Core\Type\TextType;
19
use Symfony\Component\Form\FormBuilderInterface;
20
use Symfony\Component\Validator\Constraints\NotBlank;
21
22
final class Przelewy24GatewayConfigurationType extends AbstractType
23
{
24
    public function buildForm(FormBuilderInterface $builder, array $options): void
25
    {
26
        $builder
27
            ->add('merchant_id', TextType::class, [
28
                'label' => 'bitbag_sylius_przelewy24_plugin.ui.merchant_id',
29
                'constraints' => [
30
                    new NotBlank([
31
                        'message' => 'bitbag_sylius_przelewy24_plugin.merchant_id.not_blank',
32
                        'groups' => ['sylius'],
33
                    ]),
34
                ],
35
            ])
36
            ->add('crc_key', TextType::class, [
37
                'label' => 'bitbag_sylius_przelewy24_plugin.ui.crc_key',
38
                'constraints' => [
39
                    new NotBlank([
40
                        'message' => 'bitbag_sylius_przelewy24_plugin.crc_key.not_blank',
41
                        'groups' => ['sylius'],
42
                    ]),
43
                ],
44
            ])
45
            ->add('environment', ChoiceType::class, [
46
                'choices' => [
47
                    'bitbag_sylius_przelewy24_plugin.ui.sandbox' => Przelewy24BridgeInterface::SANDBOX_ENVIRONMENT,
48
                    'bitbag_sylius_przelewy24_plugin.ui.production' => Przelewy24BridgeInterface::PRODUCTION_ENVIRONMENT,
49
                ],
50
                'label' => 'bitbag_sylius_przelewy24_plugin.ui.environment',
51
                'constraints' => [
52
                    new NotBlank([
53
                        'message' => 'bitbag_sylius_przelewy24_plugin.environment.not_blank',
54
                        'groups' => ['sylius'],
55
                    ]),
56
                ],
57
            ])
58
        ;
59
    }
60
}
61