IdealOnlineTransferSubForm   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 25
c 1
b 0
f 0
dl 0
loc 78
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A addOnlineBankTransferType() 0 12 1
A buildForm() 0 5 1
A getPropertyPath() 0 3 1
A addBankGroupType() 0 17 1
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Yves\Payone\Form;
9
10
use Generated\Shared\Transfer\PaymentTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PaymentTransfer 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...
11
use SprykerEco\Shared\Payone\PayoneApiConstants;
12
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
13
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
14
use Symfony\Component\Form\FormBuilderInterface;
15
16
class IdealOnlineTransferSubForm extends OnlineTransferSubForm
17
{
18
    public const PAYMENT_METHOD = 'ideal_online_transfer';
19
    public const OPTION_BANK_COUNTRIES = 'ideal online transfer bank countries';
20
    public const OPTION_BANK_GROUP_TYPES = 'ideal online transfer bank group types';
21
22
    /**
23
     * @return string
24
     */
25
    public function getName()
26
    {
27
        return PaymentTransfer::PAYONE_IDEAL_ONLINE_TRANSFER;
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    public function getPropertyPath()
34
    {
35
        return PaymentTransfer::PAYONE_IDEAL_ONLINE_TRANSFER;
36
    }
37
38
    /**
39
     * @param \Symfony\Component\Form\FormBuilderInterface $builder
40
     * @param array $options
41
     *
42
     * @return void
43
     */
44
    public function buildForm(FormBuilderInterface $builder, array $options)
45
    {
46
        parent::buildForm($builder, $options);
47
48
        $this->addBankGroupType($builder, $options);
49
    }
50
51
    /**
52
     * @param \Symfony\Component\Form\FormBuilderInterface $builder
53
     * @param array $options
54
     *
55
     * @return $this
56
     */
57
    public function addOnlineBankTransferType(FormBuilderInterface $builder, array $options)
58
    {
59
        $builder->add(
60
            static::FIELD_ONLINE_BANK_TRANSFER_TYPE,
61
            HiddenType::class,
62
            [
63
                'label' => false,
64
                'data' => PayoneApiConstants::ONLINE_BANK_TRANSFER_TYPE_IDEAL,
65
            ]
66
        );
67
68
        return $this;
69
    }
70
71
    /**
72
     * @param \Symfony\Component\Form\FormBuilderInterface $builder
73
     * @param array $options
74
     *
75
     * @return $this
76
     */
77
    protected function addBankGroupType(FormBuilderInterface $builder, array $options)
78
    {
79
        $builder->add(
80
            static::FIELD_BANK_GROUP_TYPE,
81
            ChoiceType::class,
82
            [
83
                'label' => false,
84
                'required' => true,
85
                'expanded' => false,
86
                'multiple' => false,
87
                'placeholder' => false,
88
                'choices' => $options[static::OPTIONS_FIELD_NAME][static::OPTION_BANK_GROUP_TYPES],
89
                'constraints' => [],
90
            ]
91
        );
92
93
        return $this;
94
    }
95
}
96