Completed
Push — develop ( 44ec0d...21eab1 )
by Michiel
02:03
created

SendSmsChallengeType::getBlockPrefix()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * Copyright 2014 SURFnet bv
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace Surfnet\StepupSelfService\SelfServiceBundle\Form\Type;
20
21
use Surfnet\StepupBundle\Value\PhoneNumber\CountryCodeListing;
22
use Symfony\Component\Form\AbstractType;
23
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
24
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
25
use Symfony\Component\Form\Extension\Core\Type\TextType;
26
use Symfony\Component\Form\FormBuilderInterface;
27
use Symfony\Component\OptionsResolver\OptionsResolver;
28
29
class SendSmsChallengeType extends AbstractType
30
{
31
    public function buildForm(FormBuilderInterface $builder, array $options)
32
    {
33
        $builder
34
            ->add('country', ChoiceType::class, [
35
                'label'                          => /** @Ignore */ 'country code',
36
                'horizontal_label_class'         => 'sr-only',
37
                'required'                       => true,
38
                'choices' => CountryCodeListing::asArray(),
39
                'preferred_choices'              =>
40
                    ['Surfnet\StepupBundle\Value\PhoneNumber\CountryCodeListing', 'isPreferredChoice'],
41
                'horizontal_input_wrapper_class' => 'foo',
42
            ])
43
            ->add('subscriber', TextType::class, [
44
                'label'                          => /** @Ignore */ 'subscriberNumber',
45
                'horizontal_label_class' => 'sr-only',
46
                'required'                       => true,
47
                'horizontal_input_wrapper_class' => 'foo',
48
                'attr'                           => [
49
                    'autofocus' => true,
50
                    'class' => 'pull-right',
51
                    'placeholder' => '612345678',
52
                ]
53
            ])
54
            ->add('sendChallenge', SubmitType::class, [
55
                'label' => 'ss.form.ss_send_sms_challenge.button.send_challenge',
56
                'attr' => [ 'class' => 'btn btn-primary pull-right' ],
57
            ]);
58
    }
59
60
    public function configureOptions(OptionsResolver $resolver)
61
    {
62
        $resolver->setDefaults([
63
            'attr' => ['class' => 'form-inline'],
64
            'data_class' => 'Surfnet\StepupSelfService\SelfServiceBundle\Command\SendSmsChallengeCommand',
65
        ]);
66
    }
67
68
    public function getBlockPrefix()
69
    {
70
        return 'ss_send_sms_challenge';
71
    }
72
}
73