Passed
Push — master ( b0332a...d14e47 )
by Rafał
04:03
created

AbstractGatewayConfigurationExtension   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 5
dl 0
loc 31
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B buildForm() 0 25 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PH\Bundle\CoreBundle\Form\Extension;
6
7
use Symfony\Component\Form\AbstractTypeExtension;
8
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
9
use Symfony\Component\Form\FormBuilderInterface;
10
use Symfony\Component\Validator\Constraints\NotBlank;
11
use Symfony\Component\Validator\Constraints\Range;
12
use Symfony\Component\Validator\Constraints\Type;
13
14
abstract class AbstractGatewayConfigurationExtension extends AbstractTypeExtension
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function buildForm(FormBuilderInterface $builder, array $options)
20
    {
21
        $builder
22
            ->add('minAmount', IntegerType::class, [
23
                'constraints' => [
24
                    new NotBlank([
25
                        'groups' => 'ph',
26
                    ]),
27
                    new Range([
28
                        'min' => 0,
29
                        'groups' => 'ph',
30
                    ]),
31
                    new Type('integer'),
32
                ],
33
            ])
34
            ->add('maxAmount', IntegerType::class, [
35
                'constraints' => [
36
                    new NotBlank([
37
                        'groups' => 'ph',
38
                    ]),
39
                    new Type('integer'),
40
                ],
41
            ])
42
        ;
43
    }
44
}
45