Passed
Pull Request — dev (#5)
by Aleksey
10:53
created

CreditCardSubForm::configureOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * MIT License
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace SprykerEco\Yves\Braintree\Form;
9
10
use Generated\Shared\Transfer\BraintreePaymentTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfer\BraintreePaymentTransfer 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\Braintree\BraintreeConfig;
12
use Symfony\Component\Form\FormInterface;
13
use Symfony\Component\Form\FormView;
14
use Symfony\Component\OptionsResolver\OptionsResolver;
15
16
class CreditCardSubForm extends AbstractSubForm
17
{
18
    public const PAYMENT_METHOD = 'credit_card';
19
20
    /**
21
     * @return string
22
     */
23
    public function getName()
24
    {
25
        return BraintreeConfig::PAYMENT_METHOD_CREDIT_CARD;
26
    }
27
28
    /**
29
     * @return string
30
     */
31
    public function getPropertyPath()
32
    {
33
        return BraintreeConfig::PAYMENT_METHOD_CREDIT_CARD;
34
    }
35
36
    /**
37
     * @return string
38
     */
39
    public function getTemplatePath()
40
    {
41
        return BraintreeConfig::PROVIDER_NAME . '/' . static::PAYMENT_METHOD;
42
    }
43
44
    /**
45
     * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver
46
     *
47
     * @return void
48
     */
49
    public function configureOptions(OptionsResolver $resolver): void
50
    {
51
        $resolver->setDefaults([
52
            'data_class' => BraintreePaymentTransfer::class,
53
        ])->setRequired(static::OPTIONS_FIELD_NAME);
54
    }
55
56
    /**
57
     * @param \Symfony\Component\Form\FormView $view The view
58
     * @param \Symfony\Component\Form\FormInterface $form The form
59
     * @param array $options The options
60
     *
61
     * @return void
62
     */
63
    public function buildView(FormView $view, FormInterface $form, array $options)
64
    {
65
        parent::buildView($view, $form, $options);
66
67
        $view->vars[static::CLIENT_TOKEN] = $this->generateClientToken();
68
    }
69
}
70