PrePaymentForm::addLabel()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 13
rs 10
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 Generated\Shared\Transfer\PayonePaymentTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\PayonePaymentTransfer 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...
12
use Spryker\Yves\StepEngine\Dependency\Form\SubFormInterface;
13
use SprykerEco\Shared\Payone\PayoneConstants;
14
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
15
use Symfony\Component\Form\FormBuilderInterface;
16
use Symfony\Component\OptionsResolver\OptionsResolver;
17
18
class PrePaymentForm extends AbstractPayoneSubForm
19
{
20
    public const PAYMENT_METHOD = 'prepayment';
21
22
    /**
23
     * @return string
24
     */
25
    public function getName()
26
    {
27
        return PaymentTransfer::PAYONE_PRE_PAYMENT;
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    public function getPropertyPath()
34
    {
35
        return PaymentTransfer::PAYONE_PRE_PAYMENT;
36
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function getTemplatePath()
42
    {
43
        return PayoneConstants::PROVIDER_NAME . '/' . self::PAYMENT_METHOD;
44
    }
45
46
    /**
47
     * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver
48
     *
49
     * @return void
50
     */
51
    public function configureOptions(OptionsResolver $resolver)
52
    {
53
        $resolver->setDefaults([
54
            'data_class' => PayonePaymentTransfer::class,
55
        ])->setRequired(SubFormInterface::OPTIONS_FIELD_NAME);
56
    }
57
58
    /**
59
     * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver
60
     *
61
     * @return void
62
     */
63
    public function setDefaultOptions(OptionsResolver $resolver)
64
    {
65
        $this->configureOptions($resolver);
66
    }
67
68
    /**
69
     * @param \Symfony\Component\Form\FormBuilderInterface $builder
70
     * @param array $options
71
     *
72
     * @return void
73
     */
74
    public function buildForm(FormBuilderInterface $builder, array $options)
75
    {
76
        $this->addLabel($builder);
77
    }
78
79
    /**
80
     * @param \Symfony\Component\Form\FormBuilderInterface $builder
81
     *
82
     * @return $this
83
     */
84
    protected function addLabel(FormBuilderInterface $builder)
85
    {
86
        $builder->add(
87
            self::FIELD_PAYMENT_METHOD,
88
            HiddenType::class,
89
            [
90
                'label' => false,
91
                'required' => false,
92
                'data' => [],
93
            ]
94
        );
95
96
        return $this;
97
    }
98
}
99