UserExtraBettingType::configureOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
namespace App\GameExtraBetting\Business\Form;
3
4
use Symfony\Component\Form\AbstractType;
5
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
6
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
7
use Symfony\Component\Form\FormBuilderInterface;
8
use Symfony\Component\OptionsResolver\OptionsResolver;
9
10
class UserExtraBettingType extends AbstractType
11
{
12
    public function buildForm(FormBuilderInterface $builder, array $options)
13
    {
14
        $extrabet = $options['extrabet'];
15
        $teams = $options['teams'];
16
        $label = $options['label'];
17
        $type = $options['type'];
18
19
        $builder
20
            ->setAction('/saveextrabet')
21
            ->setMethod('POST')
22
            ->add('text', ChoiceType::class, array(
23
                'label' => $label,
24
                'choices' => $teams,
25
                'data' => $extrabet ? $extrabet->getText() : null
26
            ))
27
            ->add('type', HiddenType::class, array(
28
                'data' => $type
29
            ))
30
        ;
31
    }
32
33
    public function configureOptions(OptionsResolver $resolver)
34
    {
35
        $resolver->setDefaults(array(
36
            'extrabet' => null,
37
            'teams' => null,
38
            'label' => null,
39
            'type' => null
40
        ));
41
    }
42
}