AddressTypeExtension::getExtendedTypes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
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