configureOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
/*
3
 * Copyright (C) 2020  Jan Böhmer
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU Affero General Public License as published
7
 * by the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU Affero General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Affero General Public License
16
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17
 */
18
19
namespace App\Form;
20
21
use Symfony\Component\Form\AbstractType;
22
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
23
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
24
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
25
use Symfony\Component\Form\FormBuilderInterface;
26
use Symfony\Component\OptionsResolver\OptionsResolver;
27
use Symfony\Component\Security\Core\Validator\Constraints\UserPassword;
28
29
class PaymentOrderManualConfirmationType extends AbstractType
30
{
31
    public function buildForm(FormBuilderInterface $builder, array $options)
32
    {
33
        $builder->add('reason', TextareaType::class, [
34
            'label' => 'payment_order.manual_confirmation.reason.label',
35
            'required' => true,
36
        ]);
37
38
        $builder->add('password', PasswordType::class, [
39
            'label' => 'payment_order.action.manual_confirmation.password.label',
40
            'required' => true,
41
            'constraints' => [
42
                new UserPassword(),
43
            ],
44
        ]);
45
46
        $builder->add('submit', SubmitType::class, [
47
            'label' => 'payment_order.confirm.submit.label',
48
        ]);
49
    }
50
51
    public function configureOptions(OptionsResolver $resolver)
52
    {
53
        $resolver->setDefault('data_class', null);
54
    }
55
}
56