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 Gewebe\SyliusVATPlugin\Config\VatNumberValidatorConfig;
0 ignored issues
show
Bug introduced by
The type Gewebe\SyliusVATPlugin\C...atNumberValidatorConfig was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Sylius\Bundle\AddressingBundle\Form\Type\AddressType;
9
use Symfony\Component\Form\AbstractTypeExtension;
10
use Symfony\Component\Form\Extension\Core\Type\TextType;
11
use Symfony\Component\Form\FormBuilderInterface;
12
13
class AddressTypeExtension extends AbstractTypeExtension
14
{
15
    public function __construct(
16
        private readonly VatNumberValidatorConfig $vatNumberValidatorConfig,
17
    ) {
18
    }
19
20
    public function buildForm(FormBuilderInterface $builder, array $options): void
21
    {
22
        $builder->add(
23
            'vatNumber',
24
            TextType::class,
25
            [
26
                'label' => 'gewebe_sylius_vat_plugin.ui.vat_number',
27
                'required' => $this->vatNumberValidatorConfig->isRequired,
28
            ],
29
        );
30
    }
31
32
    public static function getExtendedTypes(): array
33
    {
34
        return [
35
            AddressType::class,
36
        ];
37
    }
38
}
39