AvataxConfigurationType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 36 1
A getBlockPrefix() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Odiseo\SyliusAvataxPlugin\Form\Type;
6
7
use Sylius\Bundle\AddressingBundle\Form\Type\ZoneChoiceType;
8
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
9
use Sylius\Component\Core\Model\Scope;
10
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
11
use Symfony\Component\Form\Extension\Core\Type\TextType;
12
use Symfony\Component\Form\FormBuilderInterface;
13
14
final class AvataxConfigurationType extends AbstractResourceType
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function buildForm(FormBuilderInterface $builder, array $options): void
20
    {
21
        parent::buildForm($builder, $options);
22
23
        $builder
24
            ->add('appName', TextType::class, [
25
                'label' => 'odiseo_sylius_avatax_plugin.form.avatax_configuration.app_name',
26
            ])
27
            ->add('appVersion', TextType::class, [
28
                'label' => 'odiseo_sylius_avatax_plugin.form.avatax_configuration.app_version',
29
            ])
30
            ->add('machineName', TextType::class, [
31
                'label' => 'odiseo_sylius_avatax_plugin.form.avatax_configuration.machine_name',
32
                'required' => false,
33
            ])
34
            ->add('sandbox', CheckboxType::class, [
35
                'label' => 'odiseo_sylius_avatax_plugin.form.avatax_configuration.sandbox',
36
            ])
37
            ->add('accountId', TextType::class, [
38
                'label' => 'odiseo_sylius_avatax_plugin.form.avatax_configuration.account_id',
39
            ])
40
            ->add('licenseKey', TextType::class, [
41
                'label' => 'odiseo_sylius_avatax_plugin.form.avatax_configuration.license_key',
42
            ])
43
            ->add('shippingTaxCode', TextType::class, [
44
                'label' => 'odiseo_sylius_avatax_plugin.form.avatax_configuration.shipping_tax_code',
45
                'required' => false,
46
            ])
47
            ->add('enabled', CheckboxType::class, [
48
                'label' => 'sylius.ui.enabled',
49
            ])
50
            ->add('zone', ZoneChoiceType::class, [
51
                'zone_scope' => Scope::TAX,
52
            ])
53
            ->add('senderData', AvataxConfigurationSenderDataType::class, [
54
                'label' => 'odiseo_sylius_avatax_plugin.form.avatax_configuration.sender_data',
55
            ])
56
        ;
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62
    public function getBlockPrefix(): string
63
    {
64
        return 'odiseo_avatax_configuration';
65
    }
66
}
67