CantonType::configureOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 37
Code Lines 32

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 32
c 1
b 0
f 1
dl 0
loc 37
rs 9.408
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the TheAlternativeZurich/events project.
5
 *
6
 * (c) Florian Moser <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace App\Form;
13
14
use Symfony\Component\Form\AbstractType;
15
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
16
use Symfony\Component\OptionsResolver\OptionsResolver;
17
18
class CantonType extends AbstractType
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function configureOptions(OptionsResolver $resolver)
24
    {
25
        $resolver->setDefaults([
26
            'choices' => [
27
                'Aargau' => 'AG',
28
                'Appenzell Ausserrhoden' => 'AR',
29
                'Appenzell Innerrhoden' => 'AI',
30
                'Basel-Landschaft' => 'BL',
31
                'Basel-Stadt' => 'BS',
32
                'Bern' => 'BE',
33
                'Fribourg' => 'FR',
34
                'Genève' => 'GF',
35
                'Glarus' => 'GL',
36
                'Graubünden' => 'GR',
37
                'Jura' => 'JU',
38
                'Luzern' => 'LU',
39
                'Neuchâtel' => 'NE',
40
                'Nidwalden' => 'NW',
41
                'Obwalden' => 'OW',
42
                'Schaffhausen' => 'SH',
43
                'Schwyz' => 'SZ',
44
                'Solothurn' => 'SO',
45
                'St. Gallen' => 'SG',
46
                'Ticino' => 'TI',
47
                'Thurgau' => 'TG',
48
                'Uri' => 'UR',
49
                'Vaud' => 'VD',
50
                'Valais' => 'VS',
51
                'Zug' => 'ZG',
52
            ],
53
            'choice_translation_domain' => false,
54
            'choice_translation_locale' => null,
55
            'alpha3' => false,
56
        ]);
57
58
        $resolver->setAllowedTypes('choice_translation_locale', ['null', 'string']);
59
        $resolver->setAllowedTypes('alpha3', 'bool');
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65
    public function getParent()
66
    {
67
        return ChoiceType::class;
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73
    public function getBlockPrefix()
74
    {
75
        return 'country';
76
    }
77
}
78