buildForm()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 4
rs 10
1
<?php
2
3
/**
4
 * Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\PunchoutCatalogs\Communication\Form;
9
10
use Generated\Shared\Transfer\PunchoutCatalogConnectionTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...talogConnectionTransfer 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 Spryker\Zed\Kernel\Communication\Form\AbstractType;
12
use Symfony\Component\Form\Extension\Core\Type\TextType;
13
use Symfony\Component\Form\FormBuilderInterface;
14
use Symfony\Component\Validator\Constraints\Length;
15
use Symfony\Component\Validator\Constraints\NotBlank;
16
17
/**
18
 * @method \SprykerEco\Zed\PunchoutCatalogs\PunchoutCatalogsConfig getConfig()
19
 * @method \SprykerEco\Zed\PunchoutCatalogs\Persistence\PunchoutCatalogsRepositoryInterface getRepository()
20
 * @method \SprykerEco\Zed\PunchoutCatalogs\Business\PunchoutCatalogsFacadeInterface getFacade()
21
 * @method \SprykerEco\Zed\PunchoutCatalogs\Communication\PunchoutCatalogsCommunicationFactory getFactory()
22
 */
23
class PunchoutCatalogCXmlConnectionFormatForm extends AbstractType
24
{
25
    /**
26
     * @param \Symfony\Component\Form\FormBuilderInterface $builder
27
     * @param array $options
28
     *
29
     * @return void
30
     */
31
    public function buildForm(FormBuilderInterface $builder, array $options): void
32
    {
33
        $this->addUsernameField($builder)
34
            ->addPasswordField($builder);
35
    }
36
37
    /**
38
     * @param \Symfony\Component\Form\FormBuilderInterface $builder
39
     *
40
     * @return $this
41
     */
42
    protected function addUsernameField(FormBuilderInterface $builder)
43
    {
44
        $builder->add(PunchoutCatalogConnectionTransfer::USERNAME, TextType::class, [
45
            'label' => 'Sender ID',
46
            'constraints' => [
47
                new NotBlank(),
48
                new Length(['max' => 255]),
49
            ],
50
        ]);
51
52
        return $this;
53
    }
54
55
    /**
56
     * @param \Symfony\Component\Form\FormBuilderInterface $builder
57
     *
58
     * @return $this
59
     */
60
    protected function addPasswordField(FormBuilderInterface $builder)
61
    {
62
        $builder->add(PunchoutCatalogConnectionTransfer::PASSWORD, TextType::class, [
63
            'label' => 'Shared Secret',
64
            'constraints' => [
65
                new NotBlank(),
66
                new Length(['max' => 255]),
67
            ],
68
        ]);
69
70
        return $this;
71
    }
72
}
73