AddressTypeExtension   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 8 1
A getExtendedTypes() 0 4 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gewebe\SyliusVATPlugin\Form\Extension;
6
7
use Sylius\Bundle\AddressingBundle\Form\Type\AddressType;
8
use Symfony\Component\Form\AbstractTypeExtension;
9
use Symfony\Component\Form\Extension\Core\Type\TextType;
10
use Symfony\Component\Form\FormBuilderInterface;
11
12
class AddressTypeExtension extends AbstractTypeExtension
13
{
14
    public function __construct(
15
        private bool $isRequired,
16
    ) {
17
    }
18
19
    public function buildForm(FormBuilderInterface $builder, array $options): void
20
    {
21
        $builder->add(
22
            'vatNumber',
23
            TextType::class,
24
            [
25
                'label' => 'gewebe_sylius_vat_plugin.ui.vat_number',
26
                'required' => $this->isRequired,
27
            ],
28
        );
29
    }
30
31
    public static function getExtendedTypes(): array
32
    {
33
        return [
34
            AddressType::class,
35
        ];
36
    }
37
}
38