CommentType   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 5 1
A configureOptions() 0 5 1
A getName() 0 4 1
A createEmptyData() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Kreta\Component\Comment\Form\Type;
14
15
use Kreta\Component\Core\Form\Type\Abstracts\AbstractType;
16
use Symfony\Component\Form\FormBuilderInterface;
17
use Symfony\Component\Form\FormInterface;
18
use Symfony\Component\OptionsResolver\OptionsResolver;
19
20
/**
21
 * Class CommentType.
22
 *
23
 * @author Beñat Espiña <[email protected]>
24
 * @author Gorka Laucirica <[email protected]>
25
 */
26
class CommentType extends AbstractType
27
{
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function buildForm(FormBuilderInterface $builder, array $options)
32
    {
33
        parent::buildForm($builder, $options);
34
        $builder->add('description', 'textarea');
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function configureOptions(OptionsResolver $resolver)
41
    {
42
        parent::configureOptions($resolver);
43
        $resolver->setRequired(['issue']);
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49
    public function getName()
50
    {
51
        return 'kreta_comment_comment_type';
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57
    protected function createEmptyData(FormInterface $form)
58
    {
59
        return $this->factory->create($this->options['issue'], $this->user);
60
    }
61
}
62