ProjectType::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace PRReviewWatcher\Form\Type;
4
5
use Symfony\Component\Form\AbstractType;
6
use Symfony\Component\Form\FormBuilderInterface;
7
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
8
9
class ProjectType extends AbstractType
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14
    public function buildForm(FormBuilderInterface $builder, array $options)
15
    {
16
        $builder
17
            ->add('name', 'text')
18
            ->add('branch', 'text')
19
            ->add('credential', 'choice', array(
20
                'choices' => $options['credentialChoices'],
21
            ))
22
            ->add('comment', 'textarea')
23
            ->add('alive', 'checkbox', array(
24
                'required' => false,
25
            ));
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function getName()
32
    {
33
        return 'project';
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function setDefaultOptions(OptionsResolverInterface $resolver)
40
    {
41
        $resolver->setRequired(['credentialChoices']);
42
43
        $resolver->setDefaults(['credentialChoices' => array()]);
44
    }
45
}
46