UserBettingType   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 22
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 6

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 21 5
A configureOptions() 0 7 1
1
<?php
2
namespace App\GameBetting\Business\Form;
3
4
use App\GameCore\Persistence\Entity\Game;
5
use Symfony\Component\Form\AbstractType;
6
use Symfony\Component\Form\FormBuilderInterface;
7
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
8
use Symfony\Component\OptionsResolver\OptionsResolver;
9
10
class UserBettingType extends AbstractType
11
{
12
    public function buildForm(FormBuilderInterface $builder, array $options)
13
    {
14
        /** @var Game $game */
15
        $game = $options['game'];
16
        $bet = $options['bet'];
17
        $editable = $options['editable'];
18
19
        $builder
20
            ->setAction('/savebet')
21
            ->setMethod('POST')
22
            ->add('firstTeamResult', IntegerType::class, array(
23
                'required' => true,
24
                'label' => $game ? $game->getTeamFirst()->getName() : null,
0 ignored issues
show
introduced by
$game is of type App\GameCore\Persistence\Entity\Game, thus it always evaluated to true. If $game can have other possible types, add them to src/GameBetting/Business/Form/UserBettingType.php:14
Loading history...
25
                'data' => $bet ? $bet->getFirstTeamResult() : null,
26
                'disabled' => $editable
27
            ))
28
            ->add('secondTeamResult', IntegerType::class, array(
29
                'required' => true,
30
                'label' => $game ? $game->getTeamSecond()->getName() : null,
0 ignored issues
show
introduced by
$game is of type App\GameCore\Persistence\Entity\Game, thus it always evaluated to true. If $game can have other possible types, add them to src/GameBetting/Business/Form/UserBettingType.php:14
Loading history...
31
                'data' => $bet ? $bet->getSecondTeamResult() : null,
32
                'disabled' => $editable
33
            ))
34
        ;
35
    }
36
37
    public function configureOptions(OptionsResolver $resolver)
38
    {
39
        $resolver->setDefaults(array(
40
           'game' => null,
41
           'bet' => null,
42
           'editable' => null,
43
            'csrf_protection' => false
44
        ));
45
    }
46
47
}