IRCServerType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
B buildForm() 0 27 1
A configureOptions() 0 7 1
1
<?php
2
3
namespace Xdaysaysay\AdminBundle\Form\Type;
4
5
use Symfony\Component\Form\AbstractType;
6
use Symfony\Component\Form\FormBuilderInterface;
7
use Symfony\Component\OptionsResolver\OptionsResolver;
8
use Symfony\Component\Validator\Constraints as Assert;
9
10
/**
11
 * Class IRCServerType
12
 * @package Xdaysaysay\AdminBundle\Form\Type
13
 */
14
class IRCServerType extends AbstractType
15
{
16
    /**
17
     * @param FormBuilderInterface $builder
18
     * @param array $options
19
     *
20
     * @throws \Symfony\Component\Validator\Exception\ConstraintDefinitionException
21
     * @throws \Symfony\Component\Validator\Exception\InvalidOptionsException
22
     * @throws \Symfony\Component\Validator\Exception\MissingOptionsException
23
     */
24
    public function buildForm(FormBuilderInterface $builder, array $options)
25
    {
26
        $builder->add('name', null, [
27
            'label'       => 'admin.irc_server.form.label.name',
28
            'constraints' => [
29
                new Assert\NotBlank(),
30
            ],
31
        ]);
32
        $builder->add('host', null, [
33
            'label'       => 'admin.irc_server.form.label.host',
34
            'constraints' => [
35
                new Assert\NotBlank(),
36
            ],
37
        ]);
38
        $builder->add('port', null, [
39
            'label'       => 'admin.irc_server.form.label.port',
40
            'constraints' => [
41
                new Assert\NotBlank(),
42
            ],
43
        ]);
44
        $builder->add('port_ssl', null, [
45
            'label' => 'admin.irc_server.form.label.port_ssl',
46
        ]);
47
        $builder->add('website', null, [
48
            'label' => 'admin.irc_server.form.label.website',
49
        ]);
50
    }
51
52
    /**
53
     * @param OptionsResolver $resolver
54
     *
55
     * @throws \Symfony\Component\OptionsResolver\Exception\AccessException
56
     */
57
    public function configureOptions(OptionsResolver $resolver)
58
    {
59
        $resolver->setDefaults([
60
            'data_class'         => 'Xdaysaysay\CoreBundle\Entity\IRCServer',
61
            'translation_domain' => 'admin',
62
        ]);
63
    }
64
}
65