UnitType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
c 1
b 1
f 0
lcom 0
cbo 4
dl 0
loc 38
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B buildForm() 0 24 1
A configureOptions() 0 3 1
1
<?php
2
/**
3
 * (c) Tomasz Kunicki <[email protected]>
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
namespace AppBundle\Form\Type;
9
10
use Symfony\Component\Form\AbstractType;
11
use Symfony\Component\Form\FormBuilderInterface;
12
use Symfony\Component\OptionsResolver\OptionsResolver;
13
use Symfony\Component\Validator\Constraints\Length;
14
use Symfony\Component\Validator\Constraints\NotBlank;
15
16
/**
17
 * Class UnitType
18
 *
19
 * @package AppBundle\Form\Type
20
 */
21
class UnitType extends AbstractType
22
{
23
    /**
24
     * @param FormBuilderInterface $builder
25
     * @param array $options
26
     */
27
    public function buildForm(FormBuilderInterface $builder, array $options)
28
    {
29
        $builder
30
            ->add(
31
                'name',
32
                'text',
33
                array(
34
                    'constraints' => [
35
                        new Length(array('min' => 1, 'max' => 64)),
36
                        new NotBlank(),
37
                    ]
38
                )
39
            )
40
            ->add(
41
                'shortcut',
42
                'text',
43
                array(
44
                    'constraints' => [
45
                        new Length(array('min' => 1, 'max' => 3)),
46
                        new NotBlank(),
47
                    ]
48
                )
49
            );
50
    }
51
52
    /**
53
     * @param OptionsResolver $resolver
54
     */
55
    public function configureOptions(OptionsResolver $resolver)
56
    {
57
    }
58
}
59