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

AbstractGatewayConfigurationExtension::buildForm()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

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